This is a migrated thread and some comments may be shown as answers.

How to bind MVVM attributes to KendoGrid Command buttons

5 Answers 21 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Grant
Top achievements
Rank 2
Veteran
Iron
Grant asked on 10 Oct 2019, 08:00 AM

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

5 Answers, 1 is accepted

Sort by
0
Accepted
Alex Hajigeorgieva
Telerik team
answered on 11 Oct 2019, 08:57 AM

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.
0
Grant
Top achievements
Rank 2
Veteran
Iron
answered on 11 Oct 2019, 09:08 AM

Thanks Alex, you're a champion!

-Cheers, Grant

0
Alex Hajigeorgieva
Telerik team
answered on 15 Oct 2019, 07:43 AM

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.
0
Marck
Top achievements
Rank 1
answered on 02 Mar 2020, 07:28 PM

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

MVVM is broken as the grid binds the data.

0
Alex Hajigeorgieva
Telerik team
answered on 03 Mar 2020, 02:47 PM

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.
Tags
MVVM
Asked by
Grant
Top achievements
Rank 2
Veteran
Iron
Answers by
Alex Hajigeorgieva
Telerik team
Grant
Top achievements
Rank 2
Veteran
Iron
Marck
Top achievements
Rank 1
Share this question
or