<button> Disabled from boolean in observable

4 posts, 0 answers
  1. James
    James avatar
    20 posts
    Member since:
    Apr 2012

    Posted 18 May 2012 Link to this post

    How do I set enable/disable based on a value in the observable?

    I tried everything I can think of.

    Thanks!
  2. Marc
    Marc avatar
    1 posts
    Member since:
    Feb 2012

    Posted 30 May 2012 Link to this post

    Hi James,

    there is an example in the MVVM documentation, see http://www.kendoui.com/documentation/framework/mvvm/bindings/disabled.aspx 

    hth
  3. Kendo UI is VS 2017 Ready
  4. Wannes
    Wannes avatar
    12 posts
    Member since:
    Oct 2011

    Posted 24 Aug 2012 Link to this post

    Hello James and Mark,

    I have the same kind of problem with the Q2 2012 release.
    This kind of binding only seems to initially disable the input element. When changing the viewmodel, the disabled attribute doesn't automatically change.

    You can, however, customize the binders to make it work. E.g.:
    kendo.data.binders.disabled = kendo.data.Binder.extend({
        refresh: function() {
            var element = $(this.element);
            var disabled = this.bindings["disabled"].get();
            if (disabled) {
                element.attr("disabled", "disabled").addClass("k-state-disabled").removeClass("k-state-focused");
            } else {
                element.removeAttr("disabled").removeClass("k-state-disabled");
            }
        }
    });

    Best Regards,
    Wannes.
  5. tahmed
    tahmed avatar
    7 posts
    Member since:
    Aug 2012

    Posted 28 Mar 2014 Link to this post

    Is this issue resolved in latest release of Kendo UI.

    Thanks,
    Sudhir
Back to Top
Kendo UI is VS 2017 Ready