This is a migrated thread and some comments may be shown as answers.

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

2 Answers 226 Views
HTML5, CSS, JavaScript
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Michael
Top achievements
Rank 1
Michael asked on 03 Sep 2015, 11:23 AM

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 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetina
Telerik team
answered on 07 Sep 2015, 09:04 AM
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.

 
0
Michael
Top achievements
Rank 1
answered on 07 Sep 2015, 01:44 PM

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. ​

Tags
HTML5, CSS, JavaScript
Asked by
Michael
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Michael
Top achievements
Rank 1
Share this question
or