Ok, so here are both the CListView and CGridView extensions
Number of downloads: 15
I haven't yet included any documentation, but they are fairly well commented.
This does mean that:
- you cannot have different listviews/gridviews on the same page that use the same GET parameters (so for two listviews for example, you would have to change the pagination and sorting GET vars for them to work together)
- all the widgets on the page must be accessed from the same action that generated the page (this can easily be got around but perhaps with a loss of coherence between the different parameters)
I have changed my approach for parsing parameters from updaters - previously I imitated the original js implementation by extracting the parameters from the normal link, and merging them with those in the key link for the widget, perhaps overriding them with parameters from the location querystring or the hash fragment, but I believe this can lead to inconsistencies.
So now, when binding the links, I assume a parameter (which means it is harder to add custom updaters, especially ones which change more than one parameter). Thus for paging links I will only extract the pageVar parameter, and for sorting links likewise.
Handling the input ajax (for the gridview) seems good, with entering text in one input only adding one parameter, and removing text from one not resulting in others being erased.
The advanced search function (which is not actually part of CGridView) can be included in this, simply by manually defining the selector for the input updaters.
So an example of the parameters to add to the widget's construction would be:
'ajaxUpdate' => $searchId,
'inputUpdater' => '#'.$gridId.' .filters input, #'.$gridId.' .filters select, #'.$searchId.' form input, #'.$searchId.' form select',
is the id that I have added to the div containing the advanced search form, inputUpdater
is the id given to the gridview widget.
to the ajaxUpdate
means that whenever the grid is updated, the search form is also updated.
I hope this works for you all. Please let me know if there are any bugs.
Once I have ironed everything out I will make it available as an extension.
I should have said - to use, jus unzip into the extensions folder, then for your widget use 'ext.RRListView' etc
This post has been edited by RedRabbit: 03 June 2011 - 06:24 AM