4 Answers, 1 is accepted
Hi,
First I have no idea how I posted an empty thread, I pressed enter to go to the net line, next thing the thread had been created.
Im very new to Observable objects and MVVM, and have having trouble with a specific scenario. My Example in Kendo Dojo should help this along, http://dojo.telerik.com/UVumA. I've created a over simplified login page where the 'login' button is only enabled once a user name, password and company are entered/selected.
So I have a form Reset button in my page, which we know clears any fields in its respective form when clicked. However when they are cleared, its not affecting the enabled status of the login button. As you see in the example, I have to manually clear each field (or probably one field) in the observable object for the 'LoginEnabled' to be triggered.
Can I simply trigger the loginEnabled to run when the reset is clicked? Is there a better way to achieve my goal?
Thanks and Kind Regards,
Grant
Thank you for the provided example.
In this case, the fastest approach will be to set only one of the ViewModel fields to null.
The loginEnabled() function can be called inside the resetClicked() function using this.loginEnabled(), but this will not achieve the desired result as even after the reset the DropDown value will not return null and the button will not be disabled.
Also, please have in mind that if the MVVM approach is used we recommend initializing the widget using the MVVM approach as well:
http://demos.telerik.com/kendo-ui/dropdownlist/mvvm
Regards,
Stefan
Progress Telerik
Hi Stefan,
Thanks for the reply. Your solution of setting one of the fields to null before triggering the loginEnabled() is great.
Is there a document (or do you have advise) that specifies when best to use MVVM vs. manual init. vs hybrid init? The reason is that Im using Spring Thymeleaf and sometimes titles/values/messages have to be read from a message.properties file for the sake of internationalization.
I look forward to you answer.
Thanks,
Grant
In general, we recommend using only one of the approaches MVVM or jQuery based on the needs and the specifics of the application. The recommendation is more based on the consistency of the application than on the limitations that may occur.
Still, a hybrid approach can be used if the specifics scenarios is requiring it as our widgets are using MVVM binding internally even if they are initialized using the jQuery approach.
Regards,
Stefan
Progress Telerik