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

adding new record with ordering descending edits existing record

1 Answer 33 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Greg asked on 03 Jun 2015, 11:58 AM

I've got a listview that is backed with a remote datasource.

I want the datasource to be ordered by the client so that new items added are automatically placed in the correct place (total number of items will not be that many).

If I order the items using in 'asc', then triggering listview.add() works as expected, however if I reverse the direction so it's 'desc', then listview.add() results in it editing the last item in the list instead.


Example posted here

     dataSource: {
        data: [
            { name: "A Doe" },
            { name: "B Doe" },
            { name: "C Doe" },
        { name: "D Doe" },
            { name: "E Doe" }         
        sort: [{ field: 'name', dir: 'desc' }]
    template: "<div>#:name#</div>",
    editTemplate: '<div><input type="text" name="name" data-bind="value:name" /></div>'
// get a reference to the list view widget
var listView = $("#listView").data("kendoListView");
// add item


Kind regards,

1 Answer, 1 is accepted

Sort by
Alexander Popov
Telerik team
answered on 05 Jun 2015, 01:14 PM
Hi Greg,

This happens because the add method actually puts the first item in edit mode. This behavior is incorrect when using sorting as in the example you shared, so I have logged it as an issue in our public tracker. Until we fix this you can use the workaround demonstrated here.

As a token of gratitude for your involvement your Telerik points have been updated.

Alexander Popov
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Asked by
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question