Hi
I am busy doing a POC to figure out if Kendo Web Grid will fulfill all our requirements for a grid. I am currently stuck with server side grouping.
Please can I ask for some clarity on how to handle the response from the server for grouping.
The grid is not grouped by default, but they can choose to group by any of the columns..one or more..so the response needs to know this as well.
We are using the HTML/Js version of the grid with Ruby on Rails.
Our data is created from a backend query that is formatted into json.
eg: of our response with no grouping :
{"items":[{"countries":{"name":"South Africa","iso_alpha_2":"ZA","iso_alpha_3":"ZAF"}},...
The grid is initialized like this
dataGrid.kendoGrid({
dataSource: data_source,
groupable: true,
sortable: true,
pageable: {
refresh: true
},
columns: [
#{columns_json}
]
});
and our Datasource like this:
data_source = new kendo.data.DataSource({
transport: {
read: {
url: "#{data_table.url}",
dataType: "json"
},
parameterMap: function (options, operation) {
return options;
}
},
batch: true,
pageSize: 10,
serverGrouping: true,
serverPaging: true,
schema: {
data: function(response){
if (response.items) {
return response.items;
} else return null;
},
total: function (response) {
if (response.items)
return response.total_count;
else
return 0;
}
}
});
How must the server response be formatted if a person has grouped by a column? I am assuming the response format is different if it is grouped compared to if it isn't...how can that scenario be easily handled as well?
I hope I am clear in my request.
I am busy doing a POC to figure out if Kendo Web Grid will fulfill all our requirements for a grid. I am currently stuck with server side grouping.
Please can I ask for some clarity on how to handle the response from the server for grouping.
The grid is not grouped by default, but they can choose to group by any of the columns..one or more..so the response needs to know this as well.
We are using the HTML/Js version of the grid with Ruby on Rails.
Our data is created from a backend query that is formatted into json.
eg: of our response with no grouping :
{"items":[{"countries":{"name":"South Africa","iso_alpha_2":"ZA","iso_alpha_3":"ZAF"}},...
The grid is initialized like this
dataGrid.kendoGrid({
dataSource: data_source,
groupable: true,
sortable: true,
pageable: {
refresh: true
},
columns: [
#{columns_json}
]
});
and our Datasource like this:
data_source = new kendo.data.DataSource({
transport: {
read: {
url: "#{data_table.url}",
dataType: "json"
},
parameterMap: function (options, operation) {
return options;
}
},
batch: true,
pageSize: 10,
serverGrouping: true,
serverPaging: true,
schema: {
data: function(response){
if (response.items) {
return response.items;
} else return null;
},
total: function (response) {
if (response.items)
return response.total_count;
else
return 0;
}
}
});
How must the server response be formatted if a person has grouped by a column? I am assuming the response format is different if it is grouped compared to if it isn't...how can that scenario be easily handled as well?
I hope I am clear in my request.