PDA

View Full Version : Grid w/ Checkboxmodel -- have server return previously selected records as selected?



JohnJones357
30 Jun 2014, 11:15 AM
I have multiple grids with selType:checkboxmodel. The user selects the records, then submits. For editing a previous submission, I will load the store for all grids and will need to show the records that were previously selected. Simply passing "checked":true or "selected":true in the JSON does not work for checkboxmodels.

Instead of using selType: checkboxmodel which automatically creates a "checkcolumn" as the first column, I can instead hardcode the checkcolumn as the first column by doing xtype:checkcolumn.
The major difference here will be that xtype:checkcolum will also have a dataIndex, for example "CHKCOL", so if I was to send "CHKCOL":true in the JSON, this will select that record. However, using a hardcoded checkcolumn greatly impacts my existing code because of the extensive use of the getSelectionModel().getSelection() methods in my controller. In some places i can replace this method with getModifiedRecords() method but that creates even more issues.

So my question is what property or flag etc will backend need to send in JSON for previously selected records to show as selected on load?

thanks

mitchellsimoens
16 Jul 2014, 9:47 AM
What you need to do is add the record IDs to any load request of the store so that your server knows about the selected records and it can return it.