I want to disable 2nd column when 1 st row is inserted in a kendo grid, not after that

3 posts, 0 answers
  1. Anand Vardhan
    Anand Vardhan avatar
    2 posts
    Member since:
    Sep 2016

    Posted 05 Oct Link to this post

    I have a kendo ui grid with custom button which adds a new row.
    In that, I want to disable 2nd column when 1st row is inserted.
    From 2nd row on wards, I want that column to be enabled.
    I Also want to insert count in 1st column on every insert in the grid.
    For example: If the first row is inserted, I want 1st column to be "Tier 1".
    If 2nd row is inserted, then I want 1st column of 2nd row to be as "Tier 2".
    If out of 3, 2nd row is deleted... I want the 3rd row 1st column to be converted from "Tier 3" to "Tier 2".
    Can someone please help me achieve this?
    I am struggling to have this much of control in kendo grid.
  2. Marc
    Marc avatar
    67 posts
    Member since:
    Jul 2010

    Posted 05 Oct in reply to Anand Vardhan Link to this post

    Something like this will disable certain fields dynamically when adding or editing (change the if statement to true/false accordingly)

        function onEdit(e) {
            if (e.model.isNew() === false) {
                $("#PartNum").addClass("form-control");
                $("#PartNum").attr('disabled', 'disabled');
            }
        }

     

    From there I think you may be able to set properties of your item which is being passed in as (e.model).

  3. Kendo UI is VS 2017 Ready
  4. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 07 Oct Link to this post

    Hello Anand,

    My advice is to use the Grid's API and more specifically - the setOptions and addRow methods (in that order). This will allow you to modify the columns configuration before adding the new row. You can also get the total amount of items from the Grid's DataSource API, thus determining what the column titles should be.

    Regards,
    Alexander Popov
    Telerik by Progress
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
     
Back to Top