PDA

View Full Version : [CLOSED] Add values to Multiselect manually



softmachine2011
Jul 10, 2012, 1:00 PM
Hi,

How could I do something similar like this in v1.x:


MultiSelect1.store.add(new Ext.data.Record({text: 'New item', value: 4 }))

I tried with


MultiSelect1.store.add(new Ext.data.Model({ fields: [{ text: 'New item', value: 4}] }));

Because model constructor throws me an error in

Constructor Function of Ext.data.Model

if (!convertedData) {

fields = me.fields.items; // **** Here me.fields is undefined****
length = fields.length;
i = 0;
persistenceProperty = me[me.persistenceProperty];

But I have the same error

Daniil
Jul 10, 2012, 5:10 PM
Hi,

I think this should work.

Example

MultiSelect1.store.add({ text: 'New item', value: 4});

See also
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.Store-method-add

softmachine2011
Jul 11, 2012, 6:53 AM
It works thanks.

I tried this method too but like this because in documentation indicate that you must pass an array


MultiSelect1.store.add([{ text: 'New item', value: 4}]);

Daniil
Jul 11, 2012, 8:09 AM
Well, according to the docs the argument might be not an array.