grid/list view ajax won't work after 3dbc235aa588

Issue #83 invalid
created an issue

This changeset

[[|3dbc235aa588]] "changed grid and list view to register popovers and tooltips after each AJAX call"

Created an issue when in a BootGridView I register an ajax action the code is appendend in a wrong way generating an uncaught sintax error, for example



$this->widget('bootstrap.widgets.BootGridView', array( .. 'afterAjaxUpdate' => 'function() { ..myfancycode... }', ));


this will output



jQuery('#event-grid').yiiGridView({'ajaxUpdate':['event-grid'],'ajaxVar':'ajax','pagerClass':'pagination','loadingClass':'grid-view-loading','filterClass':'filters','tableClass':'items table','selectableRows':1,'pageVar':'Event_page','afterAjaxUpdate':function() { ...myfancycode... }); } js:function() { jQuery('.popover').remove(); jQuery('a[rel="popover"]').popover(); jQuery('.tooltip').remove(); jQuery('a[rel="tooltip"]').tooltip(); }}); }); }}}

You wrote {{{


if (isset($this->afterAjaxUpdate)) $this->afterAjaxUpdate .= ' '.$afterAjaxUpdate; }}}

It's not possible to concatenate the 2 functions, we must find another way if re-registering is really needed.

Comments (13)

  1. manuel_84 reporter

    There is also another problem: you register them with the default class rel="..." but in the main.php I have specified global plugins options as

    'tooltip' => array(
              'selector' => '.tooltip-bottom',
              'options' => array(
                'placement' => 'bottom'
            'popover' => array(
              'selector' => '.popover-right', // bind the plugin tooltip to anchor tags with the 'tooltip' class
              'options' => array(
                'placement' => 'right'

    ... I will not user rel attribute anymore because it will not validate as HTML5

    P.P.S. the global plugins configuration documentation where is now? it was on the extension page at but now in the new setup page, application configuration don't tell about this. I see you added popoverSelector and tooltipSelector............

  2. Алексей Найденко

    This is works for me:

    	public function init()
    		$afterAjaxUpdate = "js:function(id, data) {
    		if (isset($this->afterAjaxUpdate))
    			$afterAjaxUpdate = substr($afterAjaxUpdate,0,-1)
    		$this->afterAjaxUpdate = $afterAjaxUpdate;
  3. renate_vidruska

    Could you, please, give me a hint which file should I fix? I am a newby in yii. I have spent all day trying to figure out the cause of error and I find this issue. However, I do not understand which file should i fix (update it as you have wrote about)?

  4. Log in to comment