Jquery too much recursion yii cgridview

I have 2 CGridViews calling each other on beforeAjaxUpdate

. I can prevent recursion. I only want it to call another one time?

working grids

'beforeAjaxUpdate' =>'function(id,options){     
    var x = getQueryParams(options.url);
    var data = "sort="+x.Jobs_sort + "&ajax=detailsgeoscan-grid";
    $.fn.yiiGridView.update("detailsgeoscan-grid",{data:"sort="+x.Jobs_sort});
}',

      

detailsgeoscan mesh

'beforeAjaxUpdate' =>'function(id,options){
    var x = getQueryParams(options.url);
    var data = "Jobs_sort="+x.Jobs_sort + "&ajax=jobs-grid";
    $.fn.yiiGridView.update("jobs-grid",{data:"sort="+x.Jobs_sort});
}',

      

+3


source to share


1 answer


I think you can do it with an optional parameter isNotFirst

:

working grids

'beforeAjaxUpdate' =>'function(id,options,isNotFirst){     
    var x = getQueryParams(options.url);
    var data = "sort="+x.Jobs_sort + "&ajax=detailsgeoscan-grid";
    if(typeof isNotFirst === "undefined"){
        $.fn.yiiGridView.update("detailsgeoscan-grid",{data:"sort="+x.Jobs_sort}, true);
    }
}'

      



detailsgeoscan mesh

'beforeAjaxUpdate' =>'function(id,options,isNotFirst){
    var x = getQueryParams(options.url);
    var data = "Jobs_sort="+x.Jobs_sort + "&ajax=jobs-grid";
    if(typeof isNotFirst === "undefined"){
        $.fn.yiiGridView.update("jobs-grid",{data:"sort="+x.Jobs_sort},true);
    }
}',

      

If isNotFirst

- undefined

, the function is called by yii, so you can call another grid function with isNotFirst

true.

0


source







All Articles