1

I am using Kendo UI Grid with sortable enabled, when one of the field is sorted descending the Add new record button doesn't work (Editable: "popup") the popup window doesn't open.

here is an example http://jsbin.com/IsobegI/2/edit?html,js,output

to reproduce open the example then click on any of the fields' titles to sort descending and then click the Add new record button and it wont work, then sort ascending and click the button again it will work.

thanks for helping

4

1 回答 1

3

This has been an issue for sometime, with the telerik guys saying this is the expected behavior. There are some work arounds, including navigating to the final page when you click new (as that should work in your sample, if you navigate to the last page, and click Add new Record the popup should show up).

Here is a sample I've found from this question (Kendo grid Insert new record on the last page, last row position) which uses inline, but the same principal exists for popup editing.

http://jsfiddle.net/OnaBai/sAVGk/ This fiddle changes the above linked to use popup editing. It creates a custom toolbar item for adding a new item

toolbar   : [
    {
        name: "my-create",
        text: "Add new record"
    }
],

And binds the click event to navigate to the last page after doing an insert

$(".k-grid-my-create", grid.element).on("click", function (e) {
var dataSource = grid.dataSource;
var total = dataSource.data().length;
dataSource.insert(total, {});
dataSource.page(dataSource.totalPages());
grid.editRow(grid.tbody.children().last());

});

于 2013-08-20T13:20:47.817 回答