PDA

View Full Version : grid problem



mnask
8 Apr 2008, 10:56 PM
hi guys ,
i have problem , i have checkbox colum in my grid and i enable Drag Drop rows in grid.
the problem is , when i use enableDragDrop in gride ,, some problems come in grid like
i could not check more than one ckeckbox ,and i cant uncheck the check box ,,
the script is




var xg = Ext.grid;
var sm = new Ext.grid.CheckboxSelectionModel();
var wlCm = new Ext.grid.ColumnModel([
sm ,
{header:"Symbol", dataIndex:"symbol"},
{header:"Description", dataIndex:"description",width:220},
{header:"M", dataIndex:"m_desc", width:140},
{
header: "Show In",
dataIndex: 'showIn',
width: 110,
editor: new Ext.form.ComboBox({
typeAhead: true,
triggerAction: 'all',
transform: 'light',
lazyRender: true,
stripeRows : true,
listClass: 'x-combo-list-small' })
},


{header:"ticker_id", dataIndex:"ticker_id",hidden:'true'}

]);

wlCm.defaultSortable = true;

var saveBtn = new Ext.Toolbar.Button({
text :'Save',
handler :saveDate
});

var delAllBtn = new Ext.Toolbar.Button({
text :'Delete All',
handler :delAllTick
});

var delSelectedBtn = new Ext.Toolbar.Button({
text :'Delete Selected',
handler :delTicks
});

var saveSorting = new Ext.Toolbar.Button({
text :'Save Sorted Rows',
handler :saveSortRows
});


var wlGrid = new Ext.grid.EditorGridPanel({
id:'testtesttest',
enableColumnHide:true,
viewCofig:{
fitView:true
},
enableHdMenu:true,
trackMouseOver:true,
ds: wlDs,
cm: wlCm,
sm: sm,
plugins:checkColumn,
sortInfo:{field: 'symbol'},
title:'My Tickers',
stripeRows: true,
height:220,
width:610,
frame:true,
autoScroll: true,
ddGroup: 'GridDD',
ddText: 'Drag to change Sorting',
title: 'Order Triggers',
enableColLock:false,
enableDragDrop: true,
clicksToEdit:1,
bbar:[saveBtn,'-',delAllBtn,'-',delSelectedBtn,'-',saveSorting],
selModel: new Ext.grid.RowSelectionModel({singleSelect:false})
});

wlGrid.on('render', ordersDt);
function ordersDt(gr){
var ddrow = new Ext.dd.DropTarget(gr.getView().mainBody, {
ddGroup : 'GridDD',
copy:false,
notifyDrop : function(dd, e, data){
var sm1=gr.getSelectionModel();
var rows=sm1.getSelections();

ds = gr.getStore();
var cindex=dd.getDragData(e).rowIndex;
if (typeof cindex != "undefined") {
for (i = 0; i < rows.length; i++) {
rowData=ds.getById(rows[i].id);

if (!this.copy) {
ds.remove(wlDs.getById(rows[i].id));
ds.insert(cindex,rowData);
}
}
sm1.selectRecords(rows);
}
}
});
}



i hope u got me ..thanks
my regards