PDA

View Full Version : jQuery Sortable in extjs....?



4 Oct 2011, 4:10 AM
Can any one help me out in solving this?

I have a grid with list of elements which are draggable and droppable to another grid.

In Addition to this, I want the same grid elements to be dragged up and down.

(Like Sortable() in jQuery)

Is it possible?


I am a newbie to Extjs. Need to use this Extjs in my Salesforce VF Pages. Help me put at earliest!!

arthurakay
4 Oct 2011, 5:16 AM
Check the API docs on the grid plugin "DragDrop". The example in there is exactly what you want, I think.

http://docs.sencha.com/ext-js/4-0/#!/api/Ext.grid.plugin.DragDrop

4 Oct 2011, 9:17 AM
Thanx for your quick reply buddy!!

I am using this... where am I going wrong. Please correct me.


// Generic fields array to use in both store defs.
var fields = [
{name: 'name', mapping : 'name'}
];

// create the data store
var firstGridStore = new Ext.data.JsonStore({
fields : fields,
data : myData,
root : 'records'

});

// Column Model shortcut array
var cols = [
{id : 'name', header: "Requirement Name", width: 200, sortable: true, dataIndex: 'name',flex:true}
];

// declare the source Grid
var firstGrid = new Ext.grid.GridPanel({
ddGroup : 'secondGridDDGroup',
store : firstGridStore,
columns : cols,
enableDragDrop : true,
stripeRows : true,
autoExpandColumn : 'name',
width : 400,
region : 'west',
title : 'Phase 1',
viewConfig: {
plugins: {
ptype: 'gridviewdragdrop',
dragText: 'Drag and drop to reorganize'
}
}

});