adding new record with ordering descending edits existing record

2 posts, 1 answers
  1. Greg
    Greg avatar
    4 posts
    Member since:
    Sep 2014

    Posted 03 Jun 2015 Link to this post

    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,

  2. Answer
    Alexander Popov
    Alexander Popov avatar
    1445 posts

    Posted 05 Jun 2015 Link to this post

    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!
Back to Top