Force Afterajaxupdate

Hi Everyone

I have a cgridview and I set "afterAjaxUpdate" to do something


$this->widget('CGridView', 

....

...

array(


 'afterAjaxUpdate'=>'function(id,data){ 

        alert("a");

  }

...

...

)

Also I have another widget on the same view


$form = $this->beginWidget('CActiveForm', array(

....

....


<?php echo $form->dropDownList($model, 'modelAttr', array(1=>'selection1',2=>'selecion2'), 

array(

'ajax' => array(

                'success' => 'function(data){...; howCallafterAjaxUpdateoftheCGridView(); }',

)



How call the afterAjaxUpdate when dropDownList be selected? I want to update an element after of cgridview updating, but the cgridview updating may occurs by dropDownList.

Thanks

I think you need to call update gridvew after dropdownlist selection is changed.

if it is not, then you can do as

Code in View




<script language="javascript">

function callme(){

 alert("Ok");

}

</script>



Code in Gridview




array(


 'afterAjaxUpdate'=>'function(id,data){ 

        callme();

  }



Code for Dropdown list ajax function




'success' => 'function(data){

$.fn.yiiGridView.update("gridid");

}'



Thanks my friend

The $.fn.yiiGridView.update("gridid") works but in my case with problems

I want a functionality that updates the CGridView by selection of dropDownList and vice versa.

So the afterAjaxUpdate triggers dropDownList selection event, the the last event call again the afterAjaxUpdate trough $.fn.yiiGridView.update("gridid") in infinite loop!

So I seperated my javascript into two functions one for afterAjaxUpdate and another for $form->dropDownList selection event. Now everything works fine!

Thanks PeRoChAk for your advice :)

Hi,

The Best Solutions is your grid data is create the different page and call this page in admin.php so when u select dropdown u can only renderPartial this page so no more ajax and jquery call

Best Regards,

Ankit Modi

Hi Ankit

Both of two components are depended each other

Also I don’t want to reload entire page when cgridview or dropdown updates

May I didn’t understand what exactly you mean :)

Hi,

can you ple provide grid code.

Ankit, thank you for your response

I solved this issue as I posted it in

http://www.yiiframework.com/forum/index.php/topic/43929-force-afterajaxupdate/page__view__findpost__p__208317

Thanks :)