dear sir,
I copied the code from the demo
https://paramquery.com/pro/demos/dnd_grids. but when I drag a row data from one grid and drop it on the second grid. there is no data showing. my code is as follow. the result is as the pictures. can you help me to find the reason?
var colM = [
//first column to show grouping (for both pivot and row grouping mode). ( used along with groupModel.titleInFirstCol )
//first column to show grouping. ( used along with groupModel.titleInFirstCol )
{title: "删除数据", dataIndx:'del', editable: false, minWidth: 100, sortable: false,align:"center",copy: false,
render: function (ui) {
/*
if(( ui.rowIndx ==($('#selnumber').val()-1))){
return '';
}else{
return "<button type='button' class='delete_btn'><span style='color: red'>删除</span> </button>";
}
*/
return "<button type='button' class='delete_btn'><span style='color: red'>删除</span> </button>";
},
postRender: function (ui) {
var grid1 = this,
$cell = grid1.getCell(ui);
$cell.find(".delete_btn")
.button({ icons: { primary: 'ui-icon-scissors'} })
.bind("click", function (evt) {
grid1.deleteRow({ rowIndx: ui.rowIndx });
});
}
},
{title: "院校代码", dataIndx: "UnivCode", editable: false, sortable: false,width: 80, },
{title:'院校名称',width:160,dataIndx:'UnivName',editable: false,sortable: false, halign:'center',
filter: {
crules: [{condition: 'range'}]
}
},
{title: "专业代码", dataIndx: "MajorCode", dataType:'string', editable: false,sortable: false, width: 80,
// format: function (val) {
// return " "+val;
// }
},
{title: "专业名称", dataIndx: "MajorName", width: 300, editable: false,sortable: false,halign:'center',
filter: {
crules: [{condition: 'range'}]
}
},
{title:'招生类型',width:60,dataIndx:'UnivType', editable: false,align:'center',
filter: {
crules: [{condition: 'range'}]
}
},
{title: "科目要求", dataIndx: "SubjectName", width: 100, editable: false,sortable: false,align:'center'},
{title: "学历层次", dataIndx: "Level", width: 60, editable: false,sortable: false,align:'center'},
// {title: "招生批次", dataIndx: "Batch", width: 60, editable: false,sortable: false,align:'center'},
{title: "加权位次", dataIndx: "WeightPos", width: 80, editable: false,sortable: false,align:'center'},
{title: "招生计划数", dataIndx: "PlanNum", width: 60, editable: false,sortable: false,align:'center'},
{title: "学制", dataIndx: "UnivYears", width: 60, editable: false,sortable: false,align:'center',},
{title: "学费", dataIndx: "FeeYear", width: 60, editable: false,sortable: false,align:'center'},
{title:'所在省',width:100,dataIndx:'UnivProv', editable: false,sortable: false,align:'center',
filter: {
crules: [{condition: 'range'}]
}
},
{title:'所在市',width:100,dataIndx:'UnivCity', editable: false,sortable: false,align:'center',
filter: {
crules: [{condition: 'range'}]
}
},
{title:'办学性质',width:60,dataIndx:'UnivProty', editable: false,sortable: false,align:'center',
filter: {
crules: [{condition: 'range'}]
}
},
//{title:'位次差',dataIndx:'ChaPos',width:100, editable: false,sortable: false,align:'center', },
// {title:'与{$lastyear}年分差',dataIndx:'ChaLN',dataType:'float',width:120, format:'###.##', editable: false,copy:false,align:'center',
{title:'与{$lastyear}年分差',dataIndx:'ChaLN',width:80, dataType:'integer', editable: false,sortable: false,align:'center',
},
{title:'与{$bflastyear}年分差',dataIndx:'ChaQN',width:80, dataType:'integer',editable: false,sortable: false,align:'center',
},
{title:'与{$bfbflastyear}年分差',dataIndx:'ChaDQN',width:80, dataType:'integer', editable: false,sortable: false,align:'center',
},
{title: "序号", dataIndx: "ID", width: 10, align:'center',hidden:true,copy:false,},
{title: "用户序号", dataIndx: "uid", width: 10, align:'center',hidden:true,copy:false,},
];
userid=$('#userid').val();
var url='../../ptgkgxzxzhongxuannewdata?id='+userid;
var dataModel = {
location: "remote",
dataType: "JSON",
method: "POST",
//cache: false,
recIndx: "ID",
//url: '../../ptgkgxzxzhongxuannewdatanew',
url: url,
getData: function (data) {
datalocal=data;
return { data: data};
}
};
$("#dndgrid1").pqGrid({
height: 500,
width: '45%',
colModel: $.extend(true, [], colM),
//dataModel: $.extend(true, {}, datalocal),
dataModel: $.extend(true, {}, dataModel),
//colModel: colM,
//dataModel: { data: data,recIndx: "ID" },
complete: function () {
this.flex();
},
dragModel:{
on: true,
clsDnD: 'dnd1',
diHelper:['UnivName'],
//beforeDrop: function(){
//}
},
dropModel:{
on: true,
accept: '.dnd2'
},
//pageModel: { type: 'local', rPP: 20, rPPOptions: [1, 10, 20, 30, 40, 50, 100] },
title: "原始表",
});
$("#dndgrid2").pqGrid({
height: 500,
width: '45%',
colModel: $.extend(true, [], colM),
dataModel: $.extend(true, {}, dataModel),
//dataModel: $.extend(true, {}, datalocal),
complete: function () {
this.flex();
},
dragModel:{
on: true,
clsDnD: 'dnd2',
//diHelper:['OrderID']
},
dropModel:{
on: true,
accept: '.dnd1,.dnd2',
},
});
});