javascript - kendo ui - data-column template function is undefined in grid -



javascript - kendo ui - data-column template function is undefined in grid -

i've 2 files: customer.js , add-customer-template.html. there grid on add-customer-template.html given below.

<div id="leadsgrid" data-role="grid" data-bind="source: leadsds" date-scrollable="true" data-editable="popup" data-toolbar="['create']" data-columns='[ { field: "salesperson", title: "sales person", editor: "salespersondropdowneditor", template: "#= getsalespersonname(salesperson)#" }, {field: "date", title: "date", format: "{0:mm-dd-yyyy}"}, {field: "expecteddate", title: "expected date", format: "{0:mm-dd-yyyy}"}, {field: "expectedincome", title: "expected income", format: "{0:c}"}, {field: "details", title: "details"}, {field: "description", title: "description"}, {command: ["edit", "destroy"], title: "&nbsp;"}]'> </div>

and customer.js has 2 functions salespersondropdowneditor , getsalespersonname below.

var salespersondropdowneditor = function(container, options) { $('<input data-bind="value:' + options.field + '"/>') .appendto(container) .kendodropdownlist({ datatextfield: "salespersonname", datavaluefield: "salespersonid", datasource: new kendo.data.datasource({ transport: { read: { url: "../public/js/salespersons.json", datatype: "json" } } }) }); } var getsalespersonname= function(salespersonid) { (var idx = 0, length = customeradd.salespersondata.length; idx < length; idx++) { if (customeradd.salespersondata[idx].categoryid === customeradd.salespersondata.salespersonid) { homecoming customeradd.salespersondata[idx].salespersonname; } } }

i want display drop-down list on column sales person getting error salespersondropdowneditor not defined. when added "" around salespersondropdowneditor it's not throwing error. it's throwing error getsalespersonname not defined.

how phone call these functions , display drop-down list while editing grid ???

this 1 of negatives concerning utilize of declarative initialization (i.e. using data- attributes configure grid). you'll have configure grid in customer.js file in same scope functions.

add-customer-template.html

<div id="leadsgrid"></div>

customer.js

$('#leadsgrid').kendogrid({ datasource: leadsds, scrollable: true, editable: 'popup', toolbar: ['create'], columns: [ { field: 'salesperson', title: 'sales person', editor: salespersondropdowneditor, template: getsalespersonname }, // shortened brevity ] }); var salespersondropdowneditor = function(container, options) { // hidden brevity }; var getsalespersonname = function() { // hidden brevity };

javascript jquery kendo-ui kendo-mvvm

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -