Yii Framework Forum: Call Multiple Functions On Afterajaxupdate - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Call Multiple Functions On Afterajaxupdate Rate Topic: -----

#1 User is offline   Javed Iqbal 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 25-October 11

Posted 29 March 2014 - 01:12 AM

Hi
I want to call 2 javascript functions on bootstrap.widgets.TbGridView afterAjaxUpdate property.
Yii::import('ext.chosen.Chosen');
$this->widget('bootstrap.widgets.TbGridView', array(
    'type'=>'striped bordered condensed',
    'dataProvider'=>$model->search(),
    'template'=>"{items}{pager}",
	'filter'=>$model,
	'afterAjaxUpdate' => 'reinstallDatePicker applyChosen',//this not works
...
...

)); 

Yii::app()->clientScript->registerScript('apply-Chosen', "function applyChosen(id, data) {
		$('select.chosen').chosen();
}");
Yii::app()->clientScript->registerScript('re-install-date-picker', "
		function reinstallDatePicker(id, data) {
		$('#ClientLedger_sdt').datepicker();
}
		");

Javed Iqbal

Web Developer
syntecX Solution
skype:javedboqo
0

#2 User is offline   Vinod Agarwal 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 08-August 13

Posted 07 April 2014 - 02:30 AM

You can call second function in first one.

Yii::import('ext.chosen.Chosen');
$this->widget('bootstrap.widgets.TbGridView', array(
'type'=>'striped bordered condensed',
'dataProvider'=>$model->search(),
'template'=>"{items}{pager}",
'filter'=>$model,
'afterAjaxUpdate' => 'reinstallDatePicker',
...
...

));

Yii::app()->clientScript->registerScript('apply-Chosen', "function applyChosen() {
$('select.chosen').chosen();
}");
Yii::app()->clientScript->registerScript('re-install-date-picker', "
function reinstallDatePicker(id, data)
{
applyChosen();
$('#ClientLedger_sdt').datepicker();
}
");
0

#3 User is offline   Javed Iqbal 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 25-October 11

Posted 09 April 2014 - 01:50 AM

View PostVinod Agarwal, on 07 April 2014 - 02:30 AM, said:

You can call second function in first one.

Yii::import('ext.chosen.Chosen');
$this->widget('bootstrap.widgets.TbGridView', array(
'type'=>'striped bordered condensed',
'dataProvider'=>$model->search(),
'template'=>"{items}{pager}",
'filter'=>$model,
'afterAjaxUpdate' => 'reinstallDatePicker',
...
...

));

Yii::app()->clientScript->registerScript('apply-Chosen', "function applyChosen() {
$('select.chosen').chosen();
}");
Yii::app()->clientScript->registerScript('re-install-date-picker', "
function reinstallDatePicker(id, data)
{
applyChosen();
$('#ClientLedger_sdt').datepicker();
}
");



Yeah I call other functions in first function. Any way thanks for reply Vinod Agarwal
Javed Iqbal

Web Developer
syntecX Solution
skype:javedboqo
0

#4 User is offline   GSTAR 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,037
  • Joined: 30-October 09
  • Location:UK

Posted 17 August 2014 - 05:54 PM

Like this:

'afterAjaxUpdate'=>'js:function(id, data){
	reinstallDatePicker();
	applyChosen();
}',

1

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users