Filterable listview, showing double search box on refresh or recall

3 posts, 1 answers
  1. Ricardo
    Ricardo avatar
    2 posts
    Member since:
    Dec 2013

    Posted 13 Jan 2014 Link to this post

    Hi,

    Im trying to update my listview datasource with .read() .refresh() but it creates a new search box.  This also happens if I call the listview with data-show at the view.

    Any ideas on how to remove the old search box?

    Thanks.

    <div data-role="view" data-layout="overview-layout" id="overview-current" data-show="mobileListViewFilteringCurrent" data-title="test">
         <center><h2>TESTING</h2></center>
         <ul id="filterable-listview-current"></ul>
    </di>


    function mobileListViewFilteringCurrent() {
    $("#filterable-listview-current").kendoMobileListView({
    dataSource: new kendo.data.DataSource({
    transport: {
    read: {
    url: "http://xxx.xxx.xx/data.php?mall="+current,
    dataType: "json",
    data: {
    q: "javascript"
    }
    }
    },
    schema: {
    data: "results" 
    },
    group: {
    field: "letter"
    },
    sort: {
    field: "name",
    dir: "desc"
    }
    }),
    template: $("#customListViewTemplate").html(),
    filterable: {
    field: "name",
    placeholder: "Escriba el nombre del comercio...",
    ignoreCase: true ,
    operator: "contains"
    },
    fixedHeaders: true
    });
  2. Answer
    Ricardo
    Ricardo avatar
    2 posts
    Member since:
    Dec 2013

    Posted 14 Jan 2014 Link to this post

    Hi Ricardo,

    You are initializing the Kendo UI ListView every time you navigate to the view and the show event is fired. This is not supported and it can be a reason for a lot of unexpected errors or misbehavior. The correct event handler to instantiate the widget in would be the respective view init event handler. And you can change it on show using the setDataSource() method. Please check the following API reference:

    http://docs.kendoui.com/api/mobile/listview

    Regards,
    Kiril Nikolov
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Ricardo
    Ricardo avatar
    2 posts
    Member since:
    Dec 2013

    Posted 16 Jan 2014 Link to this post

    Hi Kiril,

    Excellent, worked like a charm.

    Thanks
Back to Top