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

How to retain the new row on top in grid

3 Answers 362 Views
Grid
This is a migrated thread and some comments may be shown as answers.
JOHNY
Top achievements
Rank 1
JOHNY asked on 29 Oct 2013, 10:30 PM
I am attempting to create a new, inline editable row on the first page of
our kendo grid. On sort and filter we would like the row to remain on the top
of the grid. It is currently getting shuffled into the table. The code which
created the new row is included below. Full cshtml attached.

 

 //add the new record row if we are on page 1
        dataSource.bind("requestEnd", function(e) {
           
            setTimeout(function() {
                var grid = $("#grid").data("kendoGrid");
                console.log("requestEnd - " + grid.dataSource.hasChanges());
                if (grid.dataSource.page() == 1) {
                   
                    //has an empty row already been added
                    if(grid.dataSource.hasChanges()) {
                   
                        grid.dataSource.cancelChanges();
                   
                    }
                   
                    newGuy = grid.dataSource.insert(0, { });
                    grid.editRow($("tr:nth(0)", grid.tbody));
                }
            });
        });

3 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 31 Oct 2013, 03:26 PM
Hi Johny,

Basically current behavior is expected as the server sorting,filtering, grouping and paging are disabled.  In current scenario I would suggest to turn these options on - that way the newly created row will always visible on current page. 

Kind Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
JOHNY
Top achievements
Rank 1
answered on 31 Oct 2013, 08:29 PM
we turned on serverPaging and serverSorting but are still getting the same behavior.
BTW:  We are using the Kendo UI Q2 2013 version
Thanks
0
Vladimir Iliev
Telerik team
answered on 04 Nov 2013, 04:10 PM
Hi Johny,

I tried to reproduce the problem locally but to no avail – everything is working as expected on our side. Could you please provide runable project where the issue is reproduced? This would help us pinpoint the exact reason for this behavior.

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