Hi,
I want to generate different IEditCells in BatchEdit dynamically for each column inside a map(). The object contains the data for columns and the columns associated IEditCell data.
Something like this:
It only works if I generate the IEditCell in the class body first but not dynamically like in this case. Is there a solution to handle this issue in this way?
Hi,
thank you for your reply. It works fine for this issue!
Now I want to use the same case as the edit dialog. If I want to use these settings for this, I get this view(see screenshot). If there is only one cell with Dropdown in the grid it will be displayed correctly. It is clear to me that this function only generates a dropdown dynamically when row is clicked. Is there a way to correctly display several dynamic dropdowns in the dialog under these basic setting?
In this case three Dropdowns for "Column"-, "Row"- and "Target"-Columns should be shown correctly.
The code below is used to generate the dynamic dropdowns.
Hi Mohammed,
thank you for your detailed reply. In your Sample the "read"-function does not work correctly. If I change the values in more than one DropdownList it takes the latest changed value vor all columns. Can you give me further assistance for this issue please.
Thank you,
Regards
[index.js]
export class BatchEdit extends SampleBase {
----
editTempObj = [];
dropdownTemp = {
create: args => {
var elem = document.createElement('input');
elem.id = 'dropedit' + args.column.field;
return elem;
},
destroy: args => {
// destroy the custom input elements
this.editTempObj[0].ej2_instances[0].destroy();
this.editTempObj.shift();
},
read: args => {
var value = args.ej2_instances[0].value;
this.editTempObj.push(args); // store the custom input element in an array
return value; // return the dropdown value from its args
},
write: args => {
var dropdownTempObj = new DropDownList({
dataSource: data,
fields: { text: args.column.field, value: args.column.field },
value: args.rowData[args.column.field]
});
dropdownTempObj.appendTo(args.element);
}
};
render() {
return (
<div className="control-pane">
<div className="control-section">
<div className="col-md-9">
<GridComponent
dataSource={data}
pageSettings={this.pageSettings}
toolbar={this.toolbarOptions}
allowPaging={true}
editSettings={this.editSettings}
>
<ColumnsDirective>
----
<ColumnDirective
field="CustomerName"
headerText="Customer Name"
width="150"
validationRules={this.validationRule}
edit={this.dropdownTemp}
/>
<ColumnDirective
field="ShipCountry"
headerText="Ship Country"
width="150"
edit={this.dropdownTemp}
/>
</ColumnsDirective>
<Inject services={[Page, Toolbar, Edit]} />
</GridComponent>
</div>
</div>
</div>
);
}
}
|