Hello Maria,
Спасибо за ваш ответ - очень высоко ценится. It may be a little challenging to provide a simple snippet demo. Below is the code from my view that now also includes snippets I got from your examples…This all works nicely until I navigate away and attempt to come back again…
Please review - I hope this provides enough information to assist.
Thanks,
JC
Template.customer.rendered = function () {
var proxy = webix.proxy('meteor', Customer);
var newCustomer = {
view: "window", modal: false, id: "customerWindow", left: 160, top: 120, css: "bradius",
head: {height: 38, template: "Add Customer"},
body: {
padding: 18, view: "form", id: "customerForm", elements: [
{view: "text", label: "Name", placeholder: "Customer Name", width: 350},
{view: "text", label: "Phone", placeholder: "1-800-555-1212"},
{view: "text", label: "Address", placeholder: "Full Address"},
{view: "text", label: "Email", placeholder: "company@company.com"},
{
cols: [
{view: "button", label: "Add", type: "form", width: 150, click: '$$("customerWindow").hide();'},
{},
{view: "button", label: "Cancel", width: 150, click: '$$("customerWindow").hide();'},
]
}
]
}
};
//datatable
var table = {
id: "customerList",
view: "datatable",
scrollY: false,
scroll: false,
select: true,
editable: true,
editaction: "dblclick",
columns: [
{id: "name", header: "Name", sort: "string", editor: "text", fillspace: 1},
{id: "status", header: "Status", sort: "string", editor: "text", fillspace: 1},
{id: "email", header: "E-mail", sort: "string", width: 200, editor: "text", fillspace: 1},
{id: "phone", header: "Phone", sort: "string", width: 150, editor: "text", fillspace: 1},
{id: "address", header: "Address", sort: "string", width: 200, width: 300, editor: "text", fillspace: 1},
{id: "trash", header: " ", align: "center", width: 35, template: "<span style='cursor:pointer;' class='webix_icon fa-trash-o'></span>"}
],
autoheight: true,
url: proxy,
save: proxy
};
var toolbar = {
view: 'toolbar',
elements: [
{view: 'label', label: 'Customers'},
{view: "button", value: " Add New Customer", width: 170, batch: "customerList", click: '$$("customerWindow").show();'},
{view: "text", id: "customerFilter", placeholder: "Filter..", width: 200, batch: "customerList"}
]
};
webix.ready (function() {
webix.ui({
container: 'tableArea',
rows: [toolbar, table]
});
webix.ui(newCustomer);
$$("customerFilter").attachEvent("onTimedKeypress", function () {
var text = this.getValue().toString().toLowerCase();
$$("customerList").filter(function (obj) {
var filter = [obj.name, obj.name].join("|");
filter = filter.toString().toLowerCase();
return (filter.indexOf(text) != -1);
});
});
$$('customerList').attachEvent('onClick', function () {
webix.confirm({
text: "Are you sure", ok: "Yes", cancel: "Cancel",
callback: function (res) {
if (res)
return false
}
});
});
$$('customerForm').bind('customerList');
});
};
Template.customer.destroyed = function () {
if (this.ui) this.ui.destructor();
};