How to set "UniqueName" in a Kendo grid, how can you, using Telerik RadGrid?

I am working on the task of transferring a dataset from Telerik RadGrid to a Kendo grid that is trying to set up sorting. I got a sorting that works fine for most of all columns, however some columns have "ambiguous" (same names) data field names. RadGrid takes this into account, allowing me to set "UniqueName" to indicate which column.

Kendo grid example

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 working example

 <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> 

Does anyone have any ideas on how to specify a "UniqueName" for the kendogrid column?

+4
source share
1 answer

Well, after a couple of hours of thinking and messing around, I realized that. The template processes what is displayed on the screen, the field is what sorting / filter uses when it passes information for sorting / filtering on the server side. I probably should have figured this out earlier, but I hope this helps someone else who is experiencing a similar brain.

Top Modification:

 var assignmentColumns = [ { title: "Last Note Date", field: "cg.Date", template: '#= kendo.toString( toDate(NoteDateTime), "M/dd/yyyy h:mmtt" ) #' } ]; 
+3
source

All Articles