View Full Version : Dumping data from store to panel HTML

3 Nov 2011, 8:20 AM
What is the best way to take data from a store with a model and output it to a panel?

I have been trying to access the store outside the definition of the panel and save the contents to a variable that could be used within the panel, but I am having no luck. Assuming I know the field to pull out of the store and there is only one record, what is the best way to get that?

3 Nov 2011, 12:08 PM
I have no idea really what you want to achieve precicely.
If your question is related to displaying the record(s) you could take a look at forms, grids and or dataviews.
But it sounds like you need to access an store inside an method of an panel? In that case you do need an reference. Maybe you can pass it at creationtime or you can use the new StoreManager. Maybe if you post some code helping is easier?

3 Nov 2011, 1:14 PM
To find a specific record from a store using the value of a know field I use:

var record = store.getAt(store.find('MY_FIELD', 'given_value'))
That will give me the record itself.
If then I need a value from that record stored in a variable I can get it using:

var str = record.get('THE_FIELD_I_AM_INTERESTED_IN')
If that is a string I can update a panel's body with the panel's update() method:


Does that help?