![](/img/trans.png)
[英]Telerik RadGrid - How do I set the MaxLength for the Insert Textbox
[英]How do I set a “UniqueName” on a Kendo Grid like you can with a Telerik RadGrid?
我正在處理一項任務,將數據集從Telerik RadGrid遷移到嘗試設置排序的Kendo Grid。 我對大多數列的排序工作正常,但是有些列具有“模糊”(相同名稱)的數據字段名稱。 RadGrid通過允許我建立'UniqueName'來指定哪一列來解釋這一點。
Kendo Grid示例
var assignmentColumns =
[
{ title: "Last Note Date", field: "NoteDateTime", template: '#= kendo.toString( toDate(NoteDateTime), "M/dd/yyyy h:mmtt" ) #' }
];
var gridDataSource = new kendo.data.DataSource({
transport: {
read: {
url: '-',
type: 'POST',
contentType: 'application/json'
},
parameterMap: function (options) {
return JSON.stringify(options);
}
},
schema: {
data: 'data',
total: 'totalItems'
},
serverPaging: true,
pageSize: 10,
serverFiltering: true,
serverSorting: true
});
$grid.kendoGrid({
dataSource: gridDataSource,
pageable: true,
scrollable: false,
sortable: {
allowUnsort: true
},
columns: assignmentColumns
});
Telerik工作實例
<telerik:RadGrid ID="radGrid_Commentary" AllowSorting="true">
<MasterTableView>
<Columns>
<telerik:GridBoundColumn DataField="NoteDateTime" UniqueName="cg.Date" HeaderText="Date" DataFormatString="{0:MM/dd/yyyy}" />
</Columns>
</MasterTableView>
</telerik:RadGrid>
有沒有人對如何為kendogrid列指定'UniqueName'有任何想法?
好吧,經過幾個小時的思考和擺弄,我發現了它。 模板處理屏幕上顯示的內容,該字段是排序/過濾器在將信息傳回服務器端排序/過濾時使用的字段。 我可能應該盡快想出來,但我希望這可以幫助其他正在經歷類似腦力的人。
上述修改:
var assignmentColumns =
[
{ title: "Last Note Date", field: "cg.Date", template: '#= kendo.toString( toDate(NoteDateTime), "M/dd/yyyy h:mmtt" ) #' }
];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.