ViewModel, Button and the enabled binding

3 posts, 1 answers
  1. Heath
    Heath avatar
    2 posts
    Member since:
    Mar 2016

    Posted 08 Aug 2016 Link to this post

    I'm having an issue with the enabled binding of a button. It's bound to function on a view model (kendo.observable) that returns a Boolean value based on the values of properties on the same view model. The binding runs once, when bound, but never again after the properties of the view model have changed. Is there any way that I can get this binding to 'refresh' on property change? Code below:

    var viewModel = kendo.observable({
        userName: null,
        password: null,
        isEnabled: function () {
            var self = this;
            return self.userName != undefined && self.password != undefined;

    And the HTML:

    <button class="k-button k-primary" data-bind="click: onClicked, enabled: isEnabled">Click</button>




  2. Answer
    Ianko avatar
    1798 posts

    Posted 10 Aug 2016 Link to this post

    Hello Heath,

    The functionality you are after is documented here:

    You should use the dependable method by using the getters of the properties in order for the method to observe the needed properties. Like in this dojo:

    Telerik by Progress
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
  3. Heath
    Heath avatar
    2 posts
    Member since:
    Mar 2016

    Posted 10 Aug 2016 in reply to Ianko Link to this post

    Ahh! I see the nuance now! That did it Ianko, many thanks!
Back to Top