Extract Gridview Update Url Using Javascript With Sort/page/filters

I have been combing through jquery.yiigridview.js and it doesn’t seem like the JS exposes a method for determining the URL that generates the current gridview content with all sorting and filters applied.

I see that you can extract the generic base URL using $.fn.yiiGridView.getUrl(“gridId”), but this doesn’t include sort/filters.

What gives? I see how filters could be extracted (by serializing the data in the filter inputs) but not how to extract sorting or pagination. This seems like a pretty big omission for the javascript API - I would be happy to be shown the right/simple way here.

At least for me (using Bootstrap) I can extract the current pagination URL and the sorting links using:




// Pagination link

$(".yiiPager .active a");


// Sorting links

$("a.sort-link.asc", "a.sort-link.desc");



But this is brutal. I’d then have to parse each URL to extract the parameters and merge them into a single data array along with the filters. Not to mention this isn’t good code; I’m manually specifying the class name. I’d really just like to “ask” the grid view what its actual update URL is.

Is there an easier way?