1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    7
    Vote Rating
    0
    CubicMushroom is on a distinguished road

      0  

    Default 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

  2. 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.

  3. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    38,546
    Vote Rating
    1120
    Answers
    3700
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default

    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 Software Engineer
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Jul 2012
    Posts
    7
    Vote Rating
    0
    CubicMushroom is on a distinguished road

      0  

    Default

    Thanks mitchellsimoens. How do I specify the field to be updates (& what it updates with)?

  5. #4
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    38,546
    Vote Rating
    1120
    Answers
    3700
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default

    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 Software Engineer
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  6. #5
    Sencha User
    Join Date
    Jul 2012
    Posts
    7
    Vote Rating
    0
    CubicMushroom is on a distinguished road

      0  

    Default

    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?

  7. #6
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    38,546
    Vote Rating
    1120
    Answers
    3700
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default

    I'm not sure I understand... like get if a record is selected in the list?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Software Engineer
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  8. #7
    Sencha User
    Join Date
    Jul 2012
    Posts
    7
    Vote Rating
    0
    CubicMushroom is on a distinguished road

      0  

    Default

    Yeah, but it's OK. I'm calling .getSelection() to get the selected records.

Thread Participants: 1

Tags for this Thread