Disable kendoGrid

1 Answer 351 Views
Grid
Brian
Top achievements
Rank 1
Brian asked on 21 Aug 2023, 08:31 PM | edited on 21 Aug 2023, 08:38 PM

I have a situation where certain users should be able to view data in a grid, but not be able to edit it. It looks like there are ways to disable individual elements of the grid, but is there a way to make it entirely readonly?

[edit: of course as soon as I finished typing this a co-worker made a suggestion that works. Simply putting the grid in a div with the class k-state-disabled does the trick]

1 Answer, 1 is accepted

Sort by
0
Vasko
Telerik team
answered on 24 Aug 2023, 11:56 AM

Hi Brian,

It is possible to employ a technique similar to the shared approach to deactivate the Grid component by placing it within a <div> with the class "k-state-disabled", however some users might find this to be misleading.

From the Kendo UI R1 2022 release, there were some redesigns for several components. As the new rendering implementation is an ongoing effort, there may be slight changes and touch-ups after the release. In addition, this redesign covers CSS Less themes, and apart from the new styling options, the state classes have also been changed, for more information about the changes, please see the following articles:

Additionally, I've added code snippets and screenshots from a sample project where I test with both class names: 

  • Grid in a <div class="k-disabled"> 
    <div class="k-disabled"> // When using a newer Kendo UI version, user k-disabled class name
    @(Html.Kendo().Grid<disable_kendoGrid.Models.OrderViewModel>()
        .Name("grid") 
        ...
    
       // Omitted for clearer code snippet 
    )
    </div>
  • Grid in a<div class="k-state-disabled">  
    <div class="k-state-disabled"> // When using older Kendo UI version, use k-state-disabled class name
    @(Html.Kendo().Grid<disable_kendoGrid.Models.OrderViewModel>()
        .Name("grid") 
        ...
    
       // Omitted for clearer code snippet 
    )
    </div>

I hope this makes it clearer why updating to newer Kendo UI versions can cause this method to stop working properly. Please contact us if you have any more inquiries.

 

Regards,
Vasko
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages. If you're new to the Telerik family, be sure to check out our getting started resources, as well as the only REPL playground for creating, saving, running, and sharing server-side code.
Tags
Grid
Asked by
Brian
Top achievements
Rank 1
Answers by
Vasko
Telerik team
Share this question
or