-
20 Oct 2012 8:10 AM #1
Answered: List view with individual item toggles
Answered: List view with individual item toggles
Hi there,
I'm trying to create a list view, based on a model, where a user can click on items to enable/disable them individually. This would then save the data to local storage every time the user clicks an item. Not sure where to start with this.
I've created a List View using the MULTI mode, but how do I hook that back in to the store to save the state of the selection?
Thanks in advance.
T
-
Best Answer Posted by mitchellsimoens
I'm not sure what you mean. You would need to listen to the selectionchange event on the list and change all records in the store to have the new field true/false based on if that record is past in the event.
-
22 Oct 2012 4:58 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
- Answers
- 3113
You can have a field on the model and when the record is selected save that to the field.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
22 Oct 2012 7:08 AM #3
Thanks mitchellsimoens. How do I specify the field to be updates (& what it updates with)?
-
22 Oct 2012 7:19 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
- Answers
- 3113
I'm not sure what you mean. You would need to listen to the selectionchange event on the list and change all records in the store to have the new field true/false based on if that record is past in the event.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
22 Oct 2012 7:57 AM #5
Ah, I was wondering if there was a way to do this automatically...
Final question then (hopefully)... How do I get the on/off state of the item selected? I can't find any indication in the passed arguments?
-
22 Oct 2012 8:21 AM #6Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
- Answers
- 3113
I'm not sure I understand... like get if a record is selected in the list?
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
22 Oct 2012 8:22 AM #7
Yeah, but it's OK. I'm calling .getSelection() to get the selected records.


Reply With Quote