PDA

View Full Version : Grid Based Form Select (Drag and Drop)



vtswingkid
8 Aug 2007, 12:05 PM
I think I put this in the wrong forum earlier.

This form object allows you to drag available items from the right box to the left box.
1 option allows you to preserve and change order in the left box.
Another option allows you to drag the same item into the box multiple times.
The grid header tool bars are accessable.
The clear button can be disabled.

The code is attached.

Create the object before adding it to the form:


this.chainSelect = new Ext.ux.DragSelect({
legend:'Chained Events',
height:200, width:325,
enableDragDrop:true,
enableClear:true,
preserveOrder:true,
allowSelectionReuse:true,
listeners: {
'change':function(){submit.enable();},
scope:this
}
});

form.add(this.chainSelect);


After rendering the form, the toolbars can be accessed with
this.chainSelect.tb1 for the left or this.chainSelect.tb2 for the right.

Populate the grids using
this.chainSelect.populate(d1,d2);
where d1 and d2 are arrays of strings

The results in the selected grid can be retrieved as an array of strings using
astr=this.chainSelect.getValues();
Or you can access the datasources directly using this.chainSelect.ds1 or ds2

This is a start. Features can easily be added to it.

galdaka
8 Aug 2007, 2:04 PM
Good work! Iwill testing your code and I will put the results here!

galdaka
27 Aug 2007, 12:53 AM
What about this method? http://extjs.com/forum/showthread.php?t=11660