Kendo Mobile - Can not refresh listview on ModalVi

2019-07-18 05:48发布

问题:

I can not refresh the listview when a dialog which add's or deletes rows from this listview is closes.

I tried several things. but the following does not work

function closeModalViewRemove() {

        $("#modalview-app-remove").kendoMobileModalView("close");
        //--- this is not working -- start ---
              refreshAppList();
        //--- this is not working -- finish ---

};


function refreshAppList() {
    var applist = $('#applist').data('kendoMobileListView');
    applist.dataSource.read();   
    applist.refresh();
}

what am I doing wrong?

回答1:

The following code should do the trick.

 $("#applist").data("kendoMobileListView").refresh()

Check documentation on refresh for further information: http://docs.telerik.com/kendo-ui/api/mobile/listview

Iam not sure why you have used datasource.read(). This function can be used only if you have dynamic data items that are loaded into a template inside the listview and you are deleting items in the source itself and reading rest of the source items after each time you close modal view.Inorder to delete row of a listview and display rest of the rows,just calling refresh function with id of the listview is enough.