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

How to pass additional props to custom editor of Grid?

2 Answers 931 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Антон
Top achievements
Rank 1
Антон asked on 05 Jun 2019, 01:36 PM

I'm trying to implement inline editing of grid row with DropDownList by following https://www.telerik.com/kendo-react-ui/components/grid/editing/editing-custom/

In that example list of options is defined inside custom component DropDownCell:

localizedData = [{ text: 'yes', value: true },{ text: 'no', value: false },{ text: '(empty)', value: null }];

But in my case list of options should be received from backend by tableId+column combination.

The problem is that I can't figure out how to pass additional parameter (list of options) to props of DropDownCell.

In the example it is used in such way: 

<GridColumn field="Discontinued" cell={DropDownCell} />

How can I pass my_column_specific_options to that cell?

I've tried the following approach

const cell = <DropDownCell options={my_column_specific_options}/>;
<GridColumn field="Discontinued" cell={cell} />

but it doesn't compile.

Please, help.

2 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 06 Jun 2019, 07:47 AM
Hello, Антон,

Thank you for the code.

I can assume that the issue occurs because the original props are not passed to the custom cell as well. The syntax can be observed in the following demo:

MyCustomCell = (props) => <CustomCell {...props} myProp={this.customData} />

https://www.telerik.com/kendo-react-ui/components/grid/cells/#toc-cell-customization

If the issue still occurs, please share an example reproducing it and I will be happy to inspect it.

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
Антон
Top achievements
Rank 1
answered on 06 Jun 2019, 09:14 AM

Hello, Stefan

Yes, now it works.

Thanks a lot!

Tags
General Discussions
Asked by
Антон
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Антон
Top achievements
Rank 1
Share this question
or