Pull down to refresh in Kendo-UI, text overlaps showing both “release” and “pull” labels

I have a problem with the pull down refresh. It works the first time, but then if I change to a different view, then come back to the original view, the Pull to refresh and Release to refresh text seem to get duplicated and overlapped on itself. I am "hardcoding" the datasource's data here, I don't want to use the transport ajax.

I am trying to manually update the data in the setOptions pull method, instead of letting Kendo update it via ajax. The actual data update works. There are no Javascript errors and I get the same result in Chrome and Firefox.

First time works:

enter image description here

After moving to another view, then back to this view, then pulling down:

enter image description here

My view code is:

<div id="subitem-view" data-role="view" data-show="showSubItems">
    <div data-role="header">
        <div data-role="navbar">

        </div>
    </div>
    <ul id="subItemList" class="itemList">
    </ul>
    <script id="subItemTemplate" type="text/x-kendo-template">
       #:Name#
    </script>
</div>

Javascript:

function showSubItems(e) {

    var subItems = new kendo.data.DataSource({
        data: [
            { Name : "Test1" },
            { Name : "Test2" }
        ] 
    });

    e.view.element.find("#subItemList").kendoMobileListView({
        dataSource: subItems,
        pullToRefresh: true,
        template: kendo.template($("#subItemTemplate").html())
    });

    if (typeof (e.view.scroller.pull) == "undefined") {
        e.view.scroller.setOptions({
            pull: function () {
                console.log("pull event...");

                subItems.data([
                    { Name : "Test1 Updated" },
                    { Name : "Test2 Updated" }
                ]);

                setTimeout(function () { e.view.scroller.pullHandled(); }, 400);
            }
        });
    }
}

Answers:

Answer

You're initializing your Kendo UI Mobile ListView on every View show which leads to unpredictable results, like recreating the pull to refresh labels. You should do it in the Init event only.

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.