I have set up a CGridView widget in my application. It displays a list of user accounts. I also have two other drop down lists that basically filter out the users. My problem is that I cannot use the values from the drop down lists to filter out the users. What I actually need is to refresh the list of user accounts based on the selected values from the drop down lists.
How am I supposed to do that with Javascript?
Yes you use Javascript to do this. CGridView’s jquery.yiigridview.js has
$('#id-of-grid').yiiGridView('update', options)function which can be used for such things:This will call the url that renders this view with a parameter
value_of_listwith the value selected in the drop down.Edit:
The
$('#id-of-grid').yiiGridView('update', options)signature indicates that you can specify which grid to update, and also the specific options to be sent. In the above example i have sent onlydata, i could have also specified which url to send the data to usingurloption. The full list of options can be seen in the link i have specified above.