[CLOSED] Access multiselect store items

  1. #1

    [CLOSED] Access multiselect store items

    We are using the following code to access a multiselect items collection:

    App.ctl00_ctl00_centerZone_ContentPlaceHolder1_statesChooser_selectedItems.store.data.items
    The result below:
    Click image for larger version. 

Name:	store-data-items.png 
Views:	44 
Size:	31.3 KB 
ID:	25008

    Actually instead of getting a constructor's collection we want to get a collection of each constructor's data object. Is there a specific method to accomplish this from the store or model objects without having to iterate through it and create a new collection?
    Last edited by fabricio.murta; Jun 30, 2017 at 7:02 PM.
  2. #2
    Hello @AdvanceLoanTechnologies!

    I believe you are looking for the store's getData() method, isn't it?

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3

    Same result when using store.getData()

    After trying using store.getData()/store.getRange() methods noticed the same result, also went deeper by using store.getData().items.

    Click image for larger version. 

Name:	store-data-items-new2.png 
Views:	42 
Size:	45.0 KB 
ID:	25009

    See another image below accessing the record we need but by using its index. However, we would expect a method such as store.getData() to return a collection of the model's data instead of a wrapper around it.

    Click image for larger version. 

Name:	store-data-items-new3.png 
Views:	43 
Size:	18.3 KB 
ID:	25010

    If it helps I'm including an image of the store in questions, notice it has a model.

    Click image for larger version. 

Name:	store-data-items-new4.png 
Views:	42 
Size:	10.6 KB 
ID:	25011
  4. #4
    Hello @AdvanceLoanTechnologies!

    You are receiving model instances. They have more data than just the record, and the record is located inside its .data property.

    In other words, you could do something like this:

    Ext.each(
        App.ctl00_ctl00_centerZone_ContentPlaceHolder1_statesChooser_selectedItems.store.getData(),
        function(entry, index, dataSet) {
            console.log(index + ": " + entry.data.Name);
        }
    );
    On a side note, the Ext.each is just an ExtJS feature to iterate through arrays.

    I hope this helps!
    Fabrício Murta
    Developer & Support Expert
  5. #5
    Thanks for clarifying this. In short we'll need to come up with a way of extracting that collection from the model.
  6. #6
    Hello @AdvanceLoanTechnologies!

    I'm not entirely sure I got your question right but, as far as getting into each store record is concerned, I'm afraid this is the way to go.
    Fabrício Murta
    Developer & Support Expert
  7. #7
    Yes you got it right thanks. Kind of suspect it after trying several store methods but wanted to explore if there was a direct way to do it.
  8. #8
    Hello again, @AdvanceLoanTechnologies!

    I guess that would settle the thread then, right? Thanks for the feedback, I'll be marking this as closed. Let us know if something went unanswered. :)
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. How to add items to a MultiSelect??
    By javito in forum 1.x Help
    Replies: 1
    Last Post: May 06, 2010, 5:57 PM
  2. [CLOSED] How can I set selected items in a MultiSelect from a Store?
    By iansriley in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 14, 2010, 4:41 PM
  3. Multiselect with Store - can't get selected items
    By CheGuevara in forum 1.x Help
    Replies: 3
    Last Post: Nov 02, 2009, 5:23 PM
  4. Clear Items from Multiselect
    By jxlarrea in forum 1.x Help
    Replies: 0
    Last Post: Aug 13, 2009, 1:20 PM
  5. Replies: 0
    Last Post: Jun 03, 2009, 5:30 PM

Posting Permissions