yii2 gridview pjax event

mustafa.yavuz picture mustafa.yavuz · Dec 28, 2015 · Viewed 8.1k times · Source

I would like to run a script after sort gridview where pjax is active. I could not find any event handler after reload of gridview. Is there any proper way of event handler after pjax call and refresh of gridview?

Answer

arogachev picture arogachev · Dec 28, 2015

Yii2 Pjax widget is just a wrapper of defunkt/jquery-pjax library, so you can view available events list in official Pjax docs in events section. Seems like you need to use pjax:success event:

$(document).on('pjax:success', function() {
    // Your code goes here ...
});