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

Does Kendo support binding the onload event to a viewModel

2 Answers 358 Views
Templates
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 29 Jan 2016, 06:17 AM

 I would like to run code in the viewModel after the page has loaded/rendered.

e.g.  <div id="terminalForm" data-bind="events: {onload: addValidator}" >

My problem I'm trying to solve is attaching a validator , which can only be done after the template has been rendered. 

$("#terminalForm").kendoValidator().data("kendoValidator");

 

 I'm building a spa app, and not sure it it's preventing the onload event firing or if the kendo bind doesn't support it.

 any help appreciated.

cheers,

 

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Rosen
Telerik team
answered on 02 Feb 2016, 07:35 AM

Hello David,

 

As you may know div elements does not have onload event. However, in order to attached the Validator widget you could decorate the element with data-role="validator" attribute.

 

Regards,
Rosen
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
David
Top achievements
Rank 1
answered on 02 Feb 2016, 10:28 PM

Thank you Rosen,

 :-)

The attribute is perfect.

Tags
Templates
Asked by
David
Top achievements
Rank 1
Answers by
Rosen
Telerik team
David
Top achievements
Rank 1
Share this question
or