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

Kendo inline add

2 Answers 21 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jiyo
Top achievements
Rank 2
Jiyo asked on 20 Nov 2019, 06:30 AM
In kendo inline adding feature when i press the add button mulitple times it generates multiple new rows to add.....is there any way to restrict that?? i.e, If a user click the add button multiple times it should only show one row for adding new data.

2 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 20 Nov 2019, 08:47 AM

Hello, Jiyo,

This can be done, by making a check to see if there is a new line added. The check will depend on the implementation.

I added it to our demo to see a possible approach:
https://stackblitz.com/edit/react-dsrwk5?file=app/main.jsx

This is the relevant code:

  addNew = () => {
    let data = [...this.state.data];
    let isNewAdded = false;
    data.forEach(item => {
      if (!item.ProductID) {
        isNewAdded = true;
        return;
      }
    });
    if (!isNewAdded) {
      const newDataItem = { inEdit: true, Discontinued: false };
      this.setState({
        data: [newDataItem, ...this.state.data]
      });
    }
  };

Regards,
Stefan
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Jiyo
Top achievements
Rank 2
answered on 20 Nov 2019, 09:24 AM
Got it....Thankyou
Tags
General Discussions
Asked by
Jiyo
Top achievements
Rank 2
Answers by
Stefan
Telerik team
Jiyo
Top achievements
Rank 2
Share this question
or