Disable Row in grid

1 Answer 75 Views
Grid
seenu
Top achievements
Rank 2
Iron
Iron
Iron
seenu asked on 18 Oct 2021, 09:45 AM

Hi,

I am working on a grid where i am enabled editable columns, all works fine as expected. my question how to disable only few rows in a grid to not editable

for example, i have 5 rows in grid and only 3 rows can be editable not others. i have column in a row that says can be editable or now

any help will be appreciated

1 Answer, 1 is accepted

Sort by
0
Filip
Telerik team
answered on 19 Oct 2021, 10:10 AM

Hello, Seenu,

The editing of a row depends on explicitly setting the desired fields that we want to edit on our data based on the editField value. In case we don't need to edit something we can simply not update that value in the data and the row will not go into edit:

https://stackblitz.com/edit/react-woamcu?file=app%2Fmain.jsx

Wherein our enterEdit function we have the following logic that prevents editing in the if statement:

  enterEdit = (dataItem) => {
    if(dataItem.ProductID === 2) {
      return;
    }
    this.setState({
      data: this.state.data.map((item) =>
        item.ProductID === dataItem.ProductID ? { ...item, inEdit: true } : item
      ),
    });
  };

Regards, PhilipProgress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Grid
Asked by
seenu
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Filip
Telerik team
Share this question
or