How to bind MVVM attributes to KendoGrid Command buttons

6 posts, 1 answers
  1. Grant
    Grant avatar
    179 posts
    Member since:
    Jul 2016

    Posted 10 Oct 2019 Link to this post

    Hi,

    As my title says, Im trying to bind MVVM attributes to command buttons in a KendoGrid. At the moment im struggling with binding an 'enabled' attr.

    Dojo: https://dojo.telerik.com/AXojaNuT

    In the above, I've bound the enabled state to a command button but it only makes the button look disabled, its still clickable.

    Please advise.

    Thanks, 
    Grant

  2. Answer
    Alex Hajigeorgieva
    Admin
    Alex Hajigeorgieva avatar
    1082 posts

    Posted 11 Oct 2019 Link to this post

    Hello, Grant,

    Thank you very much for the provided runnable Dojo. The approach that you have taken is absolutely spot on, the only issue stands with the chosen element in the template. It is not a button - it is an anchor tag and disabled is not a valid attribute for an anchor tag:

    https://dev.w3.org/html5/html-author/#the-a-element

    If you replace the <a> with a <button>, the logic will work as expected. I have also updated the Dojo to use an MVVM bound grid. Here it is for your reference:

    https://dojo.telerik.com/@bubblemaster/amIDIlUk

    Kind Regards,
    Alex Hajigeorgieva
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Grant
    Grant avatar
    179 posts
    Member since:
    Jul 2016

    Posted 11 Oct 2019 in reply to Alex Hajigeorgieva Link to this post

    Thanks Alex, you're a champion!

    -Cheers, Grant

  4. Alex Hajigeorgieva
    Admin
    Alex Hajigeorgieva avatar
    1082 posts

    Posted 15 Oct 2019 Link to this post

    Hi, Grant,

    I am glad you found my response helpful.

    Regards,
    Alex Hajigeorgieva
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  5. Marck
    Marck avatar
    1 posts
    Member since:
    Mar 2020

    Posted 02 Mar 2020 in reply to Alex Hajigeorgieva Link to this post

    Nice, but this does not work using a real transport dataSource.

    MVVM is broken as the grid binds the data.

  6. Alex Hajigeorgieva
    Admin
    Alex Hajigeorgieva avatar
    1082 posts

    Posted 03 Mar 2020 Link to this post

    Hello, Marck,

    There must be something else in the project you are working on that is breaking the binding as I tested with a remote data source with transport and it works as expected:

    https://dojo.telerik.com/eQoWECis

    I will be glad to help if you can provide some more information.

    Kind Regards,
    Alex Hajigeorgieva
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top