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

endlessScroll dataSource.remove(model) problem

1 Answer 19 Views
ListView (Mobile)
This is a migrated thread and some comments may be shown as answers.
Karl
Top achievements
Rank 1
Karl asked on 22 Apr 2013, 10:54 PM
Hi All,

I currently have a mobile listview that has endless scrolling (server paging).  By endlessScroll design, when another page is requested from scrolling, the previous page data is not available in the dataSource.   Therefore when I want to remove the item from the listview, I would typically use "dataSource.remove(model)"  The code snippet below shows where I have the dataSource.remove(model).   But if I try and remove an item from a previous page, it is not in the dataSource.   Would anyone know how I would remove the item from the listview not in the current dataSource list?   Would I need to remove it from the DOM level?   Any help would be greatly appreciated!  

Thanks in advance. 
function touchstart_inbox(e) {
            var target = $(e.touch.initialTouch),
                listview = $("#group-inbox").data("kendoMobileListView"),
                model,
                button = $(e.touch.target).find("[data-role=button]:visible");
 
            if (target.closest("[data-role=button]")[0]) {
                var ID = $(e.touch.currentTarget).find(".msgID").attr("data-id");
                if (target.closest("[data-role=button]")[0].id == "InboxDeleteButton") {
 
                    $.ajax({
                        type: 'PUT',
                        url: '/api/Message/' + ID + "/?decision=1",
                        success: function () {                          
 
                            dataSource.remove(model);
 
                        },
                        failure: function (errMsg) {
                            alert("Something happened.  Triage not recorded");
                        },
                        dataType: "json"
                    });
 
 
                }
}
}

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 24 Apr 2013, 12:22 PM
Hi Brian,

Thank you for getting in touch with us.
To remove an item that does not persists anymore in the DataSource, please delete its DOM element. In case you want to synchronize the change with the server, you can submit the record's ID through a separate Ajax request.

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
ListView (Mobile)
Asked by
Karl
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or