Because this is the arraystore that is automatically loaded when it is created (the keyword is: data:ds), there are no dynamically incremented examples, but our project requires three list boxes, and the latter two are loaded dynamically based on the contents of the first list box, so to select the contents of the first list box, Dynamically populate the contents of the latter two. I admire Exjts's example writers, the features that should be reflected in the example, none of them were written, including the previous 2.2 version of the example, and there was no online search, I've been looking for a day. How to dynamically control the function of the list data. First of all, my method is not the official method, but I brainwave think of, the following is a dynamic Add list items method.
My store for the MultiSelect object was defined before the method:
Copy Code code as follows:
Flowds = new Ext.data.ArrayStore ({
Data: [[123,123]],
Fields: [' value ', ' text ']
});
(1) var toflowstore = Msform.getform (). FindField (' Toflow '). Store; Get the store object of the MultiSelect object according to the name;
(2) Create a Ext.data.Record object, this is I think for a long time to increase the method, also blame oneself too stupid:
Copy Code code as follows:
var record = new Object ();
Record.value = "2";
Record.text = "3";
var records = new Ext.data.Record (record);
(3) Add the created Ext.data.Record object to the store object in MultiSelect:
Toflowstore.add (RECORD1);
By using the above three steps, you can dynamically add list items to the list Multisleect, reminding you to delete an item by removing the ()/removeall () method, which can be found in the itemselector.js of the sample code.
Through the above analysis, can be roughly estimated to multiselect the creation of rules, in the store has a property fields: [' value ', ' text '], when created, the system will be a loop of the way the property data:[[123,123] is created as an object and then written to its store object, similar to the following code:
Copy Code code as follows:
var item = [],itemobj,record;
for (var i = 0; i< this.data.length;i++) {
item = This.data[i];
Itemobj = new Object ();
Itemobj.value = item[0];
Itemobj.text = item[1];
Record = new Ext.data.Record (itemobj);
This.store.add (record);
}
The above is only my hunch that the specific ExtJS engineer is not so designed their procedures, has not been carefully studied.