I have DataTable1 with columns: id, num, project, notice and DataTable2 with similar columns. If i drag row from DataTable1 in DataTable2, in DataTable2 copy all selected row.
How I can drag not all values, ex. only num,project,notice, withous “id” ???
You use onBeforeDrop event handler:
I was try this event handler, but if my data load from MySQL, this method not workig…
Is there another methods?
The event is called before an item is dropped to a datatable. It does not depend on your server-side.
Hmmm… Ok, I’m using this datatable:
var pc_table = {
view:"datatable",
id:"pc",
resizeColumn:true,
dragColumn:true,
drag:true,
leftSplit:1,
columns:[
{ id:"id", editor:"text", header:"fio" , width:80, hidden:false},
{ id:"cpu", editor:"text", header:[
{ text:"Системный блок", colspan:3}, "Title"], width:280},
{ id:"motherboard", editor:"text", header:["","Материнская плата"] , width:80},
{ id:"socket", editor:"text", header:["","Сокет"], width:150},
{ id:"ramsize", editor:"text", header:"Размер ОЗУ" , width:100},
{ id:"ramtype", editor:"text", header:"Тип ОЗУ" , width:80},
{ id:"hddmodel", editor:"text", header:"Модель HDD" , width:300},
{ id:"hddsize", editor:"text", header:"Объем HDD" , width:300},
{ id:"pc_make", editor:"text", header:"Дата изготовления" , width:300},
{ id:"os_ver", editor:"text", header:"Версия ОС" , width:300},
{ id:"pc_notice", editor:"text", header:"Примечание" , width:300}
],
autowidth:false,
select:"row", editable:true, editaction:"dblclick",
save: "connector->cpu_list.php",
url:"cpu_list.php"
};
My data load from MySQL and Save in MySQL.
If i make this:
pc_table.attachEvent("onBeforeDrop", function(context, ev){
for (var i=0; i< context.source.length; i++){
context.from.copy(context.source[i],context.start,this,webix.uid());
}
return false;
});
my page not loading…
Hello,
attachEvent should be applied to Webix datatable
var pc_table = webix.ui({
view:"datatable",
...
});
pc_table.attachEvent(...);
//or
var pc_table = {
view:"datatable",
id:"pc",
...
};
webix.ui(pc_table);
$$("pc").attachEvent(...);