Click to search on your search term.
Subscribe to Fig Leaf Tutorials


Need help with a project? Contact us at sales@figleaf.com.
From code reviews to project "jumpstarts" and full life-cycle development, we've got you covered!
Check out our case studies!
Follow us on Twitter!
Click here to join our Facebook group!

Ready to upgrade your skills? Try these instructor-led classes in Washington, DC:
Ext JS 6 Bootcamp
12/04/2017

Populating a Store with Static Data

Page of 168

Grids, Combo Boxes, and Charts all display data from Stores. For combo boxes which often times display static data, such as a list of states or countries, it is often convenient to simply hardcode static values into the store instead of creating an AJAX or JSON-P web service. The syntax for hardcoding data into a Store is illustrated by the following example. Note the usage of the data property.

Ext.define('MyApp.store.Ratings, {
  extend: 'Ext.data.Store',
  fields: [
	{name: 'label'},
	{name: 'value', type: 'int'}
  ],
  data: [
    {label: 'Great', value: 5},
    {label: 'Above Average', value: 4},
    {label: 'Average', value: 3},
    {label: 'Below Average', value: 2},
    {label: 'Poor', value: 1},
  ]
});
Page of 168
comments powered by Disqus