ExtJS grid page size - letting the user decide
Sometimes you'll be using a Paging Toolbar on a grid and need to give the user the ability to change
Something that's harder than it should be is populating an EXT edit form with form data, where one of the form fields is a select box. If there is a specific set of values that this select can take, then you can hard code that using a SimpleStore, like this:
So that will populate the select box with the static values you've defined (the 5 states above), then when the form loads it will select the appropriate option automatically.
So far so good, but what if you need to load what goes into the select box dynamically? Well, first you'll need to set up your remote data store (my server is sending back JSON data, hence the JsonReader):
This will consume data like this:
And populate the store with a collection of state records which can then be loaded into the combobox.
Then all you need to do is load the store before loading the form data, and your comboboxes will be correctly populated, displaying the correct option. Here's the full example:
Be wary using the pagination options on the combobox here (see http://extjs.com/deploy/dev/docs/?class=Ext.form.ComboBox) - the reason being if your state's 'abbr' features on the second page of the results it won't populate the correct options into the combo box.
To enhance your understanding of data handling with Ext JS, you might find Force Ext.data.Store to use GET insightful, as it addresses common issues with request methods in Ext JS stores. Additionally, Proxies in Ext JS 4 provides an in-depth look at managing data operations, which would complement your reading about remote-loading forms and comboboxes.
Sometimes you'll be using a Paging Toolbar on a grid and need to give the user the ability to change
One of the classes that has a lot more prominence in Ext JS 4 is the data Proxy. Proxies are respons