Turning Off Grid Update On Change And Keydown Events


I have 3 grids on one page, One of them should be updated using button only . How can I turn off update on change and keydown events in certain grid and have those events in othere grids untouched?

by default every grid update is done by same action that rendered whole page, and whole page is rendered again, sent by ajax, but only grid contents is replaced. You can however provide separate actions for every grid that only serves data for this particular grid and configure grids on your main page to use that dedicated data providing actions (ajaxUrl attribute of CGridView). In that case only one grid should be updating because there will data only for one grid.

…or did I misunderstood you? :)

Thanks for reply anyway, but this answer has no use for me, you got idea wrong. I know how grids are refreshing and how to point separate URL for every grid I have on my page.

I’ve stuck with different task - I have 3 grids all with filters. I want 2 of them to send ajax on filter in usual Yii way - after changing any filter field. The last should be updated only when special “Filter” button is pressed. So I have to turn off “change” and “keydown” events of filter inputs of corresponding grid and leave events on other 2 grids working.

The only way I’ve found atm is doing like

$(document).off('change.yiiGridView keydown.yiiGridView');

  • but unfortunately this kills filter input events in all grids on page. I have no idea how to turn those events for only grid I need to.

Yezzzz :)

ook… but looking in the CGridView code those handlers add added only to elements matching filterSelector (http://www.yiiframework.com/doc/api/1.1/CGridView#filterSelector-detail), so if you change this property for one grid to match something that does not exist (i.e. "#not-existent-identifier") - that grid should not react to keydown/change events for filters…