This is a migrated thread and some comments may be shown as answers.

Add new data via javascript

1 Answer 83 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Korstiaan
Top achievements
Rank 1
Korstiaan asked on 16 Nov 2016, 01:44 PM

We are trying to add extra data to a grid via an onscroll listener.
This works when the data is filtered or sorted, but not when grouped.
Below is the code we currently have that is called when new data is needed.

 

var grid = $("#grid").data("kendoGrid");
var parameterMap = grid.dataSource.transport.parameterMap;       
var requestObject = parameterMap({ aggregate:grid.dataSource.aggregate(),sort: grid.dataSource.sort(), filter: grid.dataSource.filter(), group: grid.dataSource.group(), page: pagina, pageSize:grid.dataSource.pageSize() });

$.post('@Url.Action("GetAllOffers_Post", "Offer")', requestObject, function (response) {
           try {
                grid.dataSource.pushCreate(response.Data); //Works for non-grouped data
            } catch (err) {
                console.log(err);
                try {

                    //Data is grouped when we end up here
                    //var data = grid.dataSource.schema.parse(response.Data);
                    //Array.prototype.push.apply(grid.dataSource.options.schema.groups, response.Data); //API said we could use the schema.parse but that doesn't work nor does the schema.groups since grid.dataSource.schema doesn't exist
                } catch (errortwee) {
                    console.log(errortwee);
                }
            }

1 Answer, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 17 Nov 2016, 07:51 AM

Hello Korstiaan,

 

The same question is already answered in the support ticket opened on the same topic. Let us continue the conversation there.

 

For anyone interested in the same topic, the parameterMap function with a group option works only if server grouping is implemented. Therefore, the server-side grouping should be debugged in order to investigate whether the expected data is returned.

 

Regards,
Ianko
Telerik by Progress
Telerik UI for ASP.NET Core is ready for Visual Studio 2017 RC! Learn more.
Tags
Grid
Asked by
Korstiaan
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Share this question
or