webix ver 3.4.5
there are datatable:
webix.ready(function () {
var toolbar = {
id: "tlbr", view: "toolbar", elements: [
{view: "label", label: "Атрибуты"},
{
id: "btn_add_col", view: 'button', label: "Add", width: 45, click: function () {
table = $$("table_attr");
table.unselect();
table.editRow(table.add({col_is_active:true}));
}
},
{
view: 'button', label: "Del", width: 45,
click: function () {
$$("table_attr").remove($$('table_attr').getSelectedId());
}
}
]
};
var table = {
container: "box",
view: "datatable",
header: "Атрибуты",
id: 'table_attr',
select: "row",
resizeColumn: true,
minHeight: 135,
autoheight: true,
editable: true,
editaction: "custom",
liveValidation:true,
columns: [
{id: "col_id", hidden: true, header: {text: "№"}},
{id:'col_group_id', editor:"select",options:[]},
{id: "col_name", header: {text: "col_name"}, editor: "text"},
{id: "col_title", header: {text: "col_title"}, editor: "text", fillspace: true},
{id: "measurement_id", hidden: true, header: {text: "Ед. изм."}},
{
id: "col_type_id", header: {text: "col_type"}, editor: "select", options: [
{id: 1, value: 'INTEGER'},
{id: 2, value: 'FLOAT'},
{id: 3, value: 'TEXT'},
{id: 4, value: 'DATE'},
{id: 5, value: 'OBJECT'}
]
},
{id:'col_obj_id', header:{text:'Объект'}, editor:"select",options:[]},
{id: 'col_del_action',width:175, header: {text: 'Действие при удалении'},editor: 'select', options:['SET NULL', 'DELETE']},
{id: 'col_is_active', header:{text:'Вкл'}, checkValue:true, uncheckValue:false, template:'{common.checkbox()}'},
{id: "col_is_pk", hidden: true},
{id: "col_is_sys", hidden: true},
{id: "col_id_parent", hidden: true}
],
save: 'rest->/myapi',
url: 'rest->/myapi',
on:{
"onItemDblClick":function(id){
this.editRow(id);
}
},
rules:{
col_name:webix.rules.isNotEmpty
}
};
attr = webix.ui({
container:'box',
rows: [toolbar, table]
});
webix.event(window, "resize", function () {
attr.adjust();
})
});
after adding a new row post request have only 3 fields: ‘col_group_id’, ‘col_name’ and ‘col_is_active’.
Sending of all fields possible with this scenario:
-
add new row
-
doubleclick on it(enable editing)
-
edit cells, dont edit mandatory cell
-
click somewhere to disable row editing
-
doubleclick on row, edit mandatory cell
-
click somewhere again
looks like it’s a not adequate behaviour
what am I doing wrong?