Currently Kendo MVVM only supports a very simple binding syntax, one view attribute can be bound to one model attribute. I'd like to have real javascript expressions or function calls in bindings to support more complex scenarios, e.g. you only want to show the "submit" button in a form when all fields have been completed. KnockOutJS supports this: http://knockoutjs.com/documentation/visible-binding.html#note_using_functions_and_expressions_to_control_element_visibility
Hi,
The last approach is supported and is the way we should go here. Here is a small dojo that illustrates this.
Regards,
Angel Petrov
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Not good to have expressions in the View. This brakes Separation of concerns principle. It would be better to support providing method parameters binding expression like in this example: <div data-bind="visible: controlVM.isVIsible(5)"> </div> ant then in code file controlVM: { isVIsible function (param){ if(param > 2) { return true;) else {return false;} } } This way you can support some declarative logic with NO CODE IN VIEW. Or even provide VM property as a parameter, but you already have access to it trough function so this is redundant but it would look like this example: <div data-bind="visible: controlVM.isVIsible(controlVM.someProperty)"> </div>
Excellent idea! We should at least be able to call resuable functions with parameters.