Devextreme JS DXGrid如何在代码后面调用cellTemplate
我想在代码后面调用cellTemplate函数,但我无法调用。 有没有办法从后面的代码调用这个函数? 我已经尝试了,因为您可以在下面看到,但行显示“ShowButton”
ListDxColum.Add(new DxColumns(){
dataField = "cor_ref",
caption = "",
allowFiltering = false,
cellTemplate = "ShowButton"
});
JAVASCRIPT
var orders = rec.documentList;
$("#gridContainer").dxDataGrid({
dataSource: {
store: {
type: "array",
key: "ID",
data: orders
}
},
paging: {
pageSize: 8
},
showRowLines: true,
showBorders: true,
selection: {
mode: "single"
},
filterRow: { visible: true },
//searchPanel: {
// visible: true
//},
columns: rec.DxColumHeader,
paging: { pageSize: 6 },
wordWrapEnabled: true,
filterRow: { visible: false },
columnAutoWidth: false
});
function ShowButton(container, options) {
console.log(options.data["cor_ref"]);
}
你可以使用这个代码:
var orders = rec.documentList;
var grid = $("#gridContainer").dxDataGrid({
dataSource: {
store: {
type: "array",
key: "ID",
data: orders
}
},
paging: {
pageSize: 8
},
showRowLines: true,
showBorders: true,
selection: {
mode: "single"
},
filterRow: { visible: true },
//searchPanel: {
// visible: true
//},
columns: rec.DxColumHeader,
paging: { pageSize: 6 },
wordWrapEnabled: true,
filterRow: { visible: false },
columnAutoWidth: false,
cellTemplate: function (container, options) {
console.log(options.data["cor_ref"]);
}
}).dxDataGrid('instance');
链接地址: http://www.djcxy.com/p/5235.html
上一篇: Devextreme JS DXGrid how to call cellTemplate in code behind