【问题标题】:Unable to refresh the listview after deleting item using action sheet in Kendo UI Mobile使用 Kendo UI Mobile 中的操作表删除项目后无法刷新列表视图
【发布时间】:2015-04-27 10:42:59
【问题描述】:

我有一个列表视图,其中一些项目从服务器检索

<div
            id="getbookmarks"
            data-role="view"
            data-title="my bookmarks"
            data-before-show="app.views.showgetbookmarks.beforeShow"
            data-show="app.views.showgetbookmarks.show"
            data-layout="default" >


        <div data-role="touch" >

                    <ul  id="listview-getbookmarks"  data-role="listview" data-endless-scroll="true" data-template="mF"></ul>

                    <div data-role="actionsheet" id="companyActionsList"  data-open="app.views.showgetbookmarks.onOpen" data-close="app.views.showgetbookmarks.onClose" data-popup='{"direction": "left"}'  >

                        <li><a  href="#" data-action="app.views.showgetbookmarks.reply"  class="km-button delete">Delete</a></li>

                    </div>
            </div>


    </div>

模板如下所示

                        story Title <div class="h2">#= storyTitle #</div>


                      <p    data-role="button" data-rel="actionsheet" href="\\#companyActionsList" data-actionsheet-context="#: id#">Delete</p>

                    </a>




</script>

使用ajax删除项目的功能如下..我可以删除元素但listview无法自动重新加载。删除后

reply:   function (e) {

                console.log("done"+ e.context);


                          var deleteid= e.context;

                var dataSource = new kendo.data.DataSource({


                    transport: {
                        read: {
                            url: kkkkk.getServiceUrlJson() + "? hello"
                            ,type: "POST"
                            ,dataType: "json"
                            ,data: {
                                bookmarkId:deleteid

                            }
                            ,xhrFields: {
                                withCredentials: true
                            }
                        }
                    }


                });
                dataSource.read();



        },

【问题讨论】:

    标签: javascript jquery html kendo-ui kendo-mobile


    【解决方案1】:

    我遇到了同样的问题,试着把这段代码放在点击事件中

    $("#listview-getbookmarks").data('kendoMobileListView').dataSource.data().remove($(this)[0].dataItem);
    

    【讨论】:

      猜你喜欢
      • 2013-10-03
      • 2014-06-03
      • 1970-01-01
      • 1970-01-01
      • 2012-12-15
      • 1970-01-01
      • 2013-08-25
      • 2019-08-16
      • 2022-07-07
      相关资源
      最近更新 更多