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

Grouping

1 Answer 111 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bibin
Top achievements
Rank 1
Bibin asked on 12 Dec 2012, 03:27 PM
I have a grid that is populate based on a data source that is changed according to user search criteria. Web page is not refreshed when updating the grid. Here is the problem, Let say that I grouped the grid based on column A after the first search. If I click on the search again with or without changing the search criteria and repopulate the data to the grid, it no longer allow me to group based on any other column except column A ( previous grouping ).

Here is the extract of the code that does the data binding:
 $.ajax({
                    type: "POST",
                    async: true,
                    timeout: 60000,
                    url: serviceMaterialsUrl,
                    data: paramsData,
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (data) {
                        $("#grid").val('');
                        $("#grid").html('');
                        $("#grid").kendoGrid({
                            editable: false,
                            dataSource: { 
                                data: data.d,
                                pageSize: 100
                            },
                            sortable: { 
                                mode: "multiple",
                                allowUnsort: true
                            },
                            filterable: true,
                            groupable:true,
                            scrollable:true,
                            resizable: true,
                            columnMenu: true,
                            pageable: {pageSizes: [100, 200, 300]},
                            detailInit: detailInit,
                            columns: [
                                { field: "select", ..." },
                                { field:..... }
                            ]
                        });
                    },
                    error: function (err) {
                        alert('Error');
                    }
                });

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 14 Dec 2012, 03:00 PM
Hello Bibin,

Re-creating the Grid on each search is not a good idea for your case and I do not recommend using it.

I suggest you to initialize your Grid only once when the page is loaded (not each time the success function is called) and just call the appropriate method provided by the dataSource object of the Grid client object each time you perform a search.

There are methods such as group/filter/sort/page or the query method (which could combine several operations within a single server request). All are covered in our documentation.

Regards,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Bibin
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or