|
<ejs-grid #grid [dataSource]='data' allowPaging='true' [pageSettings]='pageSettings' [editSettings]='editSettings' [toolbar]='toolbar' (actionBegin)="actionBegin($event)" (actionComplete)="actionComplete($event)" > <e-columns>
<e-column field='OrderID' headerText='Order ID' width='120' textAlign='Right' isPrimaryKey='true' [validationRules]='orderidrules'></e-column>
<e-column field='CustomerName' headerText='Customer Name' width='120' [validationRules]='customeridrules'></e-column>
<e-column field='Freight' headerText='Freight' width='120' format='C2' textAlign='Right' editType='numericedit' [validationRules]='freightrules'></e-column>
<e-column field='ShipCity' headerText='Ship City' width='150' [allowEditing]='false'></e-column>
<e-column field='OrderDate' headerText='Order Date' width='130' editType='datepickeredit' format='yMd' textAlign='Right'></e-column>
<e-column field='ShipCountry' headerText='Ship Country' width='150' [allowEditing]='false' editType='dropdownedit' [edit]='editparams' ></e-column>
</e-columns>
</ejs-grid>
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- [app.component.ts] actionBegin(args: EditEventArgs) { if (args.requestType === "beginEdit" || args.requestType === "add") {
for (const cols of this.grid.columns) {
if ((cols as Column).allowEditing == false) {
(cols as Column).visible = false;
}
}
}
}
actionComplete(args: SaveEventArgs) {
if (args.requestType === "save") {
for (const cols of this.grid.columns) {
if ((cols as Column).allowEditing == false) {
(cols as Column).visible = true;
}
}
}
} |
|
|