Because this is an ArrayStore that is automatically loaded when created (the keyword is: data: ds), there is no dynamic addition example, but our project needs to have three list boxes, and the content of the last two must be loaded dynamically according to the content of the first list box. Therefore, when selecting the content of the first list box, dynamically fill in the content of the last two. I admire the exjts example writers. They have not written any of these functions that should be reflected in the example, including the previous 2.2 version examples, and I have not searched online, which made me find the function of how to dynamically control the list data for a day. First of all, my method is not an official method, but I just thought of it with a sudden idea. Here is a method to dynamically increase the list items.
Before the method, my store about the multiselect object is defined like this:
flowDs = new ({
data: [[123,123]],
fields: ['value','text']
});
(1)var toflowStore = ().findField('toflow').store; //Get the store object of the multiselect object based on the name;
(2) Create an object. This is the method I have been thinking about for a long time. I also blame myself for being too stupid:
var record = new Object();
= "2";
= "3";
var records = new (record);
(3) Add the created object to the multiselect store object:
(record1);
Through the above three steps, you can dynamically add list items to the list multisleect. Please remind me that if you delete an item, you can use the remove()/removeAll() method. The specific usage method can be found in the example code.
After the above analysis, you can roughly estimate the creation rules of multiselect. There is a property fields: ['value','text'] in the store. When creating, the system will create the content in the property data:[[123,123]] as an object object through a loop, and then write it in its store object, similar to the following code:
var item = [],itemObj,record;
for(var i = 0; i< ;i++){
item = [i];
itemObj = new Object();
= item[0];
= item[1];
record = new (itemObj);
(record);
}
The above is just my guess. Whether the extjs engineers designed their programs in this way has not been carefully studied.
Before the method, my store about the multiselect object is defined like this:
Copy the codeThe code is as follows:
flowDs = new ({
data: [[123,123]],
fields: ['value','text']
});
(1)var toflowStore = ().findField('toflow').store; //Get the store object of the multiselect object based on the name;
(2) Create an object. This is the method I have been thinking about for a long time. I also blame myself for being too stupid:
Copy the codeThe code is as follows:
var record = new Object();
= "2";
= "3";
var records = new (record);
(3) Add the created object to the multiselect store object:
(record1);
Through the above three steps, you can dynamically add list items to the list multisleect. Please remind me that if you delete an item, you can use the remove()/removeAll() method. The specific usage method can be found in the example code.
After the above analysis, you can roughly estimate the creation rules of multiselect. There is a property fields: ['value','text'] in the store. When creating, the system will create the content in the property data:[[123,123]] as an object object through a loop, and then write it in its store object, similar to the following code:
Copy the codeThe code is as follows:
var item = [],itemObj,record;
for(var i = 0; i< ;i++){
item = [i];
itemObj = new Object();
= item[0];
= item[1];
record = new (itemObj);
(record);
}
The above is just my guess. Whether the extjs engineers designed their programs in this way has not been carefully studied.