0
不確定我有2個文件:customer.js
和add-customer-template.html
。如下所示,add-customer-template.html
上有一個網格。劍道UI - 數據列模板函數以格
<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: " "}]'>
</div>
而且customer.js
具有2個功能salesPersonDropDownEditor
和getSalesPersonName
如下。
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) {
for (var idx = 0, length = customerAdd.salesPersonData.length; idx < length; idx++) {
if (customerAdd.salesPersonData[idx].CategoryID === customerAdd.salesPersonData.salesPersonID) {
return customerAdd.salesPersonData[idx].salesPersonName;
}
}
}
我想在sales person
列中顯示的下拉列表中,但錯誤salesPersonDropDownEditor
沒有定義我得到。當我在salesPersonDropDownEditor
附近添加「」時,它不會引發錯誤。現在它的投擲錯誤getSalesPersonName
未定義。
如何調用這些功能和顯示下拉列表中,同時從電網編輯???
我使用MVVM模式,所以我以這樣的方式進行配置。我如何調用這個模式???這些功能 - @Brett – Valay
我不必在文件級JS @Brett – Valay
配置電網能否請你讓我知道如何在我的現有代碼調用這些函數??? – Valay