javascript - Using Kendo Grid with Server Side Filters and Server Side Sorting, Field = NULL? -
i'm using kendo grid, server side filtering , server side sorting. in data source transport read method field null. suggestions?
this code initializing grid:
var griddatasource = new kendo.data.datasource({ transport: { read: { url: '@url.action("read", "gridmodule")', type: 'post', contenttype: 'application/json' }, parametermap: function (options) { options.assignmentfilters = assignmentfilters; return json.stringify(options); } }, pagesize: 20, serverpaging: true, serversorting: true, serverfiltering: true, schema: { model: { fields: { lastsurveydate: { type: "date" }, lastnotedate: { type: "date" } } }, data: "data", total: "totalrows" } }); var $grid = $('#gridassignments'); if (e.firstload) { $grid.kendogrid({ scrollable: true, pageable: { refresh: true, pagesizes: [20, 50, 100, 500, 1000], buttoncount: 12, messages: { display: "showing {0}-{1} {2} provider contacts", empty: "no contacts match filter criteria", itemsperpage: "contacts per page" } }, reorderable: true, navigatable: true, change: gridonchange, databound: gridondatabound, datasource: griddatasource, columnreorder: gridcolumnreorder, columnhide: gridcolumnhide, columnresize: gridcolumnresize, columnshow: gridcolumnshow, columnmenu: { sortable: false, messages: { columns: "choose columns", filter: "filter", } }, resizable: true, height: '720px', filterable: { extra: false, operators: { string: { contains: "contains", }, date: { lt: "is before", gt: "is after", equal: "on" } } }, selectable: "row", sortable: { mode: "single", allowunsort: true }, columns: [ @html.raw(model.gridcolumns.columns) ] }); } else { $grid.data('kendogrid').setdatasource(griddatasource); }
for runs same problem...
in case code worked fine until added 2 fields schema.model.fields. reason field in read method of grid module null. default fields treated strings when added 2 new properties no default used.
i had add grid's fields
schema: { model: { fields: { lastsurveydate: { type: "date" }, lastnotedate: { type: "date" }, firstname: { type: "string" }, lastname: { type: "string" }, hasneweval: { }, hascommitmentstoget: { }, onprioritylist: { type: "string" }, hasproductsbelowminimum: { type: "hasproductsbelowminimum" }, points: {}, title: { type: "string" }, provider: { type: "string" }, phone: { type: "string" }, timezone: { type: "string" }, touches: { type: "string" }, lastnotetext: { type: "string" }, verbalaging: { type: "string" } } },
that worked me.
Comments
Post a Comment