PDA

View Full Version : [RESOLVED] Extjs [3.2.1] Multiselect - Select all entries



senacle
20 May 2010, 5:13 AM
Hello !

In the multiselect extension, it's possible to select some entries with

msForm.getForm().findField('multiselect').setValue('2,3')

How to select all entries ?

(sure it's very simple, but i can't find it :(()

mankz
20 May 2010, 5:44 AM
That doesn't appear to be built-in. Try this override:



Ext.override(Ext.ux.form.MultiSelect, {
selectAll : function() {
var ids = this.store.collect(this.valueField);
this.setValue(ids);
}
});

CrazyEnigma
20 May 2010, 5:59 AM
You could use a tbar button to allow the user to select all, incorporating the above code that mankz wrote.

senacle
20 May 2010, 10:24 PM
@ mankz
Fine !

To select all entries, you've now to put this code :


msForm.getForm().findField('type_admin').selectAll();

@CrazyEnigma

Sure ! I've used the tbar as in the Multiselect example (http://www.extjs.com/deploy/dev/examples/multiselect/multiselect-demo.html)