how can i call a function after a listview was rendered?

3 posts, 1 answers
  1. Michael
    Michael avatar
    15 posts
    Member since:
    Jun 2015

    Posted 03 Sep 2015 Link to this post

    in my  observable reglagesModel , i added a dosomething() function and then i tried calling it:

    <ul  data-role="listview"  data-bind="{ events: {dataBinding: ​doSomething}}">

    and

    <ul  data-role="listview" data-show="doSomething">

     but it doesnt work.

    i am lost in the MVVM 

     thank you

     

  2. Answer
    Tsvetina
    Admin
    Tsvetina avatar
    1876 posts

    Posted 07 Sep 2015 Link to this post

    Hello Michael,

    Note that the value of the data-bind attribute should not be wrapped in curly braces. Try with:

    data-bind="events: {dataBinding: ​doSomething}, otherProperty: otherValue"
     
    Additonaly, you can see how Kendo MVVM can be set correctly in this sample app:
    Kendo UI Core Mobile App


    Regards,
    Tsvetina
    Telerik
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
  3. Michael
    Michael avatar
    15 posts
    Member since:
    Jun 2015

    Posted 07 Sep 2015 in reply to Tsvetina Link to this post

    Thanks. This answer from your support solved the problem:

    Further investigation of the issue shows that this is part of the intended behavior of the Mobile ListView. When endless scrolling is enabled, the events related to data binding do not fire. This is so because the dataBound/Binding events have a special role when the widget is MVVM bound. Triggering them when scrolling would cause a significant performance penalty (as all DOM elements would be re-iterated). As a work around, you can use the change event of the DataSource to perform your logic. It fires at the same occasions thedataBound event of the ListView would fire, so it is an equivalent place for the logic you need to execute. 

    As a work around, you can use the change event of the DataSource to perform your logic. It fires at the same occasions thedataBound event of the ListView would fire, so it is an equivalent place for the logic you need to execute. ​

Back to Top