CGridView Filter duplicate Ajax requests when usin

2019-03-03 21:40发布

问题:

In my web application I use tabs and load part of the views per Ajax. So it's possible, that I do load the same CGridView multiple times without reloading the page. If that occurs I become duplicate Ajax requests if I use CGridView Filters.

The filters and requests are standard. Following images show those simple filter and 10 GET requests if type the search value once.

Here is the code of Tabs-widget I use:

$this->widget('bootstrap.widgets.TbTabs', array(
'id' => 'thirdPartyCatTabs',
'title' => Translate::t('project', 'Categories'),
'type' => 'tabs',
'placement' => 'top',
'events' => array(
    'shown' => 'js:loadContent'
),
'tabs' => array(
    array(
        'id' => 'standardCat',
        'label' => Translate::t('project', 'Standard Categories'),
        'linkOptions' => array(
            'data-tab-url' => Yii::app()->createUrl('/thirdParty/settings/thirdPartyCategoryStandard'),
        ),
    ),
    array(
        'id' => 'standardCatMap',
        'label' => Translate::t('project', 'Standard Category-Mapping'),
        'linkOptions' => array(
            'data-tab-url' => Yii::app()->createUrl('/thirdParty/settings/showCategoryMapTab'),
        ),
    ),
)
));

I guess I have to use uniqid() at some place, but can't figure out where. Thanks.