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

difference between data-show and data-init

6 Answers 928 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Justin
Top achievements
Rank 1
Justin asked on 29 May 2012, 07:17 PM
what is the difference between data-show and data-init?  and when should you use each one?

6 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 30 May 2012, 10:08 AM
Hi Justin,

The data-init will fire once, after the view and its child widgets are initialized, while the data-show will fire every time when the view becomes visible.
The init event is suitable for actions that should be done only once, right after the initialization of the view (for example - creating a widget). The show event is appropriate for a code that you want to be executed after each show of the view.
For convenience I prepared a small example that shows the event usage in action.

Greetings,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Justin
Top achievements
Rank 1
answered on 30 May 2012, 02:58 PM
Thanks for the reply,

my question was in response to not having access to the e.view.params from the data-init event while i do have access to e.view.params from from the data-show event.  Is this the correct behavior?
0
Petyo
Telerik team
answered on 31 May 2012, 07:40 AM
Hi,

Yes, this is the expected behavior, as described in our documentation

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!
0
Abdul Hannan
Top achievements
Rank 1
answered on 11 Dec 2013, 11:05 AM
Note that data-show executes every time you call alert( ) , Phonegap's notification.confirm ( ) and notification.alert ( ) on a mobile device. This is a very strange behaviour
0
Petyo
Telerik team
answered on 11 Dec 2013, 03:34 PM
Hello Abdul,

Indeed it is - we have not received reports of such behavior so far. Is it possible for you to open a ticket with a a sample that reproduces it? We will take a look. 

Regards,
Petyo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Abdul Hannan
Top achievements
Rank 1
answered on 12 Dec 2013, 06:39 AM
Yes Petyo, I have raised this issue via Telerik Support. Please Search for "Method Bonded with data-show executes every time alert ( ) function is called " and you will find the code to reproduce the problem,
Thanks 
Tags
General Discussions
Asked by
Justin
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Justin
Top achievements
Rank 1
Petyo
Telerik team
Abdul Hannan
Top achievements
Rank 1
Share this question
or