How to refresh listView with Template

7 posts, 0 answers
  1. Mike
    Mike avatar
    21 posts
    Member since:
    Mar 2012

    Posted 17 Apr 2012 Link to this post

    The below function reads from a specific URL and loads the contents into myDiv using a template and listView.  The function works perfect the first time.  How can I force the view to refresh with new data each time the function runs (the function is triggered externally)?

    function loadNewFeed(url) {
    var dataSource = new kendo.data.DataSource({
    transport: {
    read: {
    url: url,
    dataType: "json"
    }
    }

    });
    $('#myDiv').kendoListView({
    dataSource: dataSource,
    template: kendo.template($("#reviewsTemplate").html())
    });

    };

  2. Mike
    Mike avatar
    21 posts
    Member since:
    Mar 2012

    Posted 17 Apr 2012 Link to this post

    I've been testing this issue further, and have found the following:

    When the function first runs, it executes perfectly and renders the data via the template.

    Upon subsequent runs the following javascript error occurs in Firebug:

    Error: "b is null"

    Script: kendo.all.min.js (line 8)

    Can someone from Telerik, please respond and let me know if there is a solution to this issue?

    thanks,


  3. Kendo UI is VS 2017 Ready
  4. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 18 Apr 2012 Link to this post

    Hi,

    Re-initializing the widget each time is not supported. You should create the datasource (and the widget) once, and then subsequently use the DataSource read method for data fetching. 

    All the best,
    Petyo
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  5. Mike
    Mike avatar
    21 posts
    Member since:
    Mar 2012

    Posted 18 Apr 2012 Link to this post

    Petyo,

    Thanks for the info.  I tried using the read method, but it didn't work.  Using the above example can you give me an example of where/how to use the read method?

    Thanks,

  6. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 18 Apr 2012 Link to this post

    Hi,

    Not really, as I don't see your project, and don't know what your business logic is. In general, you should call it where you are currently using the loadNewFeed. If need further assistance, I would like to recommend opening a support ticket with a sample project attached, so that we can assist you further. 

    Kind regards,
    Petyo
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  7. Mike
    Mike avatar
    21 posts
    Member since:
    Mar 2012

    Posted 18 Apr 2012 Link to this post

    OK, thanks.  I'll open a ticket momentarily.

    ===== TICKET OPENED # 535329 =======
  8. De
    De avatar
    1 posts
    Member since:
    Apr 2012

    Posted 19 Apr 2012 Link to this post

    Hai Im a new member to this forum just now I had gone through some topics and I came to a conclusion that this is very useful and thank you for all...........

Back to Top
Kendo UI is VS 2017 Ready