Results 1 to 7 of 7

Thread: List view with individual item toggles

  1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    7
    Vote Rating
    0
      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 User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,029
    Answers
    3976
    Vote Rating
    1367
      0  

    Default

    You can have a field on the model and when the record is selected save that to the field.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  4. #3
    Sencha User
    Join Date
    Jul 2012
    Posts
    7
    Vote Rating
    0
      0  

    Default

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

  5. #4
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,029
    Answers
    3976
    Vote Rating
    1367
      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 @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  6. #5
    Sencha User
    Join Date
    Jul 2012
    Posts
    7
    Vote Rating
    0
      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 User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,029
    Answers
    3976
    Vote Rating
    1367
      0  

    Default

    I'm not sure I understand... like get if a record is selected in the list?
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  8. #7
    Sencha User
    Join Date
    Jul 2012
    Posts
    7
    Vote Rating
    0
      0  

    Default

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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •