|
constructor(props) {
super(props);
this.template = this.gridTemplate;
this.state = { isValid: true };
}
gridTemplate(props) {
if (this.state.isValid === true) {
return (
<>
<CheckBoxComponent checked={true} label="Customer Name" id="name" />
</>
);
}
}
<GridComponent dataSource={employeeData} width="auto" ref={grid => (this.gridInstance = grid)}
>
<ColumnsDirective>
…………………………………………..
<ColumnDirective field="FirstName" headerText="Name" headerTemplate={this.template.bind(this)}
width="120" />
……………………………………………
</ColumnsDirective>
</GridComponent> |
I don't understand how this would work using functions. When I do the following below, it will override all cells for the 'typeDisplay' column BUT all other cells are blank because it doesn't know to revert back to whatever the default template or "no" template is:
Hi Lejay,
Greetings from Syncfusion support
Based on your query we could see that you like to render the template elements for all columns. In your shared code snippet, we found that you are returning only for the typeDisplay column. So only other coulmns are empty. To resolve the problem, we suggest you use the else part to return the elements for the other column. Please refer the below code example and sample for more information.
|
const testTemplateExe = (args: any) => { if (args.column.field === 'ShipName') return (<p>Hello</p>) else { return (<p>{args[args.column.field]}</p>) } }
|
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/1646211552423386.zip
Regards,
Rajapandi R