Hi, my KendoUI version is v2015.2.902, i use a kendo grid for server paging, sorting, filtering and now i would like to add grouping functionality.
I use "function read" mode for dataSource calling asp.net mvc controller method. (server side request object is a Kendo.Mvc.UI.DataSourceRequest object)
this is my dataSource configuration:
let dataSource: any = {
batch: true,
serverPaging: true,
serverSorting: true,
serverFiltering: true,
serverGrouping: true,
page: 1,
pageSize: 20,
transport:
{
read: function (options)
{
kendo.data.transports["aspnetmvc-ajax"].fn.options.options = { prefix: '' };
let request = kendo.data.transports["aspnetmvc-ajax"].fn.options.parameterMap(options.data, "read", false);
thisObject.httpService.GetNodes(request)
.then(function (args: IHttpServiceParameters)
{
options.success(args.data);
});
}
},
schema:
{
data: function (data)
{
return data.Data;
},
total: function (data)
{
return data.Total;
},
groups: function (data)
{
return data.Data;
},
model: model
}
};
if i not use grouping all work fine, but using grouping the data result object seem not binding correctly.
args.data.Data returned from server has this schema:
[{ AggregateFunctionsProjection: null,
Aggregates: {},
HasSubGroups: false,
Items: [], <--- Keep note of this element name
Key: "Invoice",
Member: "InvoiceColumnName",
Subgroups: [],
value: undefined
},
...]
the problem is when kendo.all.js parse the response of the server, passed from args.data.Data to convertGroup function (kendo.all.js line 7049)
in this function there is a call who reference to record.items object but the object in data returned from server is called Items (starting with uppercase)
kendo.all.js code:
function convertGroup(data, getters, modelInstance, originalFieldNames, fieldNames) {
var record,
idx,
fieldName,
length;
for (idx = 0, length = data.length; idx < length; idx++) {
record = data[idx];
fieldName = originalFieldNames[record.field];
if (fieldName && fieldName != record.field) {
record.field = fieldName;
}
record.value = modelInstance._parse(record.field, record.value);
if (record.hasSubgroups) {
convertGroup(record.items, getters, modelInstance, originalFieldNames, fieldNames); <--- Here the problem !!
} else {
convertRecords(record.items, getters, modelInstance, originalFieldNames, fieldNames); <--- Here the problem !!
}
}
}
do you have any suggestion? why the object returned from server have Items property insted of items?
How to solve?
In attachment the google developer tools screenshot.
Thanks
I use "function read" mode for dataSource calling asp.net mvc controller method. (server side request object is a Kendo.Mvc.UI.DataSourceRequest object)
this is my dataSource configuration:
let dataSource: any = {
batch: true,
serverPaging: true,
serverSorting: true,
serverFiltering: true,
serverGrouping: true,
page: 1,
pageSize: 20,
transport:
{
read: function (options)
{
kendo.data.transports["aspnetmvc-ajax"].fn.options.options = { prefix: '' };
let request = kendo.data.transports["aspnetmvc-ajax"].fn.options.parameterMap(options.data, "read", false);
thisObject.httpService.GetNodes(request)
.then(function (args: IHttpServiceParameters)
{
options.success(args.data);
});
}
},
schema:
{
data: function (data)
{
return data.Data;
},
total: function (data)
{
return data.Total;
},
groups: function (data)
{
return data.Data;
},
model: model
}
};
if i not use grouping all work fine, but using grouping the data result object seem not binding correctly.
args.data.Data returned from server has this schema:
[{ AggregateFunctionsProjection: null,
Aggregates: {},
HasSubGroups: false,
Items: [], <--- Keep note of this element name
Key: "Invoice",
Member: "InvoiceColumnName",
Subgroups: [],
value: undefined
},
...]
the problem is when kendo.all.js parse the response of the server, passed from args.data.Data to convertGroup function (kendo.all.js line 7049)
in this function there is a call who reference to record.items object but the object in data returned from server is called Items (starting with uppercase)
kendo.all.js code:
function convertGroup(data, getters, modelInstance, originalFieldNames, fieldNames) {
var record,
idx,
fieldName,
length;
for (idx = 0, length = data.length; idx < length; idx++) {
record = data[idx];
fieldName = originalFieldNames[record.field];
if (fieldName && fieldName != record.field) {
record.field = fieldName;
}
record.value = modelInstance._parse(record.field, record.value);
if (record.hasSubgroups) {
convertGroup(record.items, getters, modelInstance, originalFieldNames, fieldNames); <--- Here the problem !!
} else {
convertRecords(record.items, getters, modelInstance, originalFieldNames, fieldNames); <--- Here the problem !!
}
}
}
do you have any suggestion? why the object returned from server have Items property insted of items?
How to solve?
In attachment the google developer tools screenshot.
Thanks