Grid Cell disabling based on a condition

4 posts, 0 answers
  1. Dynamo
    Dynamo avatar
    2 posts
    Member since:
    Oct 2015

    Posted 14 Oct 2015 Link to this post

    I have to disable and enable cells of the grid under the same columns based on date validations. Is it possible to  do that in Kendo Grid?

    I am new to Kendo UI and not getting proper examples for doing this.

    P.s.Any proper example explaining this will be really  helpful.

  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2466 posts

    Posted 15 Oct 2015 Link to this post

    Hello Dynamo,

    For achieving the desired functionality you should handle the Edit event and use the model to retrieve the relevant information from the other cells and if the cell should not be edited, you could use the grid closeCell method.

    Following is a dojo example with such conditional editing:
    Hope this helps.


    Regards,
    Konstantin Dikov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Adam
    Adam avatar
    2 posts
    Member since:
    Jul 2015

    Posted 19 Nov 2020 in reply to Konstantin Dikov Link to this post

    I know this post is old but how can this be achieved if gridmode = "inline" I cannot find a way to prevent edits.
  4. Aleksandar
    Admin
    Aleksandar avatar
    281 posts

    Posted 23 Nov 2020 Link to this post

    Hello Adam,

    A possible approach would be to add a disabled attribute to the required input based on a condition:

    editable: "inline",
    edit: function(e) {
          if (e.model.age > 32) {
            e.container.find("input[name='name']").attr('disabled',true);
          }  
      }

    Here is the previously sent example with the above modification.

    Alternatively, you can try the approach discussed in this SO thread.

    Regards,
    Aleksandar
    Progress Telerik

    Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Back to Top