Help Needed On Ccheckboxcolumn

i am working on form. in which user has to select some data in gridview.

during updation of data all selected data must be automatically ticked in gridview.

my problem is all data are not provided by current model.

grid values and data to select in checkbox are entirely from two different models.

anyone help me to come out of this issue plz…

You could:

  1. When checking a checkbox, add its ID to an array and store it using setState.

  2. Assuming the update is done through AJAX, the controller will be loaded everytime you trigger $.fn.yiiGridView.update(). On the controller, you could fetch the array through getState, check if the current loop iteration ID is present in that array, and send a checked/unchecked flag in the dataProvider.

  3. On CGridView - make the checkbox checked/unchecked based on the flag.

The above would keep the checkboxes persistent during pagination, search, refresh etc.