When adding a new record I need to be able provide information for a certain columns, but not when editing the same columns. How would I do this?
Here is my html code. Also an image of what happens when I click on the add button.
|
App.component.ts
cellEdit(args) { if (
args.type === 'edit' &&
(args.columnName === 'CustomerID' || args.columnName === 'OrderDate')
) {
args.cancel = true;
}
} |
|
App.component.html
<div class="control-section">
<div class="col-lg-9">
<ejs-grid #grid id='Normalgrid' (cellEdit)="cellEdit($event)" [dataSource]='data' allowPaging='true'
[pageSettings]='pageSettings' [editSettings]='editSettings' [toolbar]='toolbar'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' width='140' textAlign='Right' isPrimaryKey='true'
[validationRules]='orderidrules'></e-column>
<e-column field='CustomerID' headerText='Customer ID' width='140' [validationRules]='customeridrules'>
</e-column>
<e-column field='Freight' headerText='Freight' width='140' format='C2' textAlign='Right'
editType='numericedit' [validationRules]='freightrules'></e-column>
<e-column field='OrderDate' headerText='Order Date' width='120' editType='datetimepickeredit'
[format]='formatoptions' textAlign='Right'></e-column>
<e-column field='ShipCountry' headerText='Ship Country' width='150' editType='dropdownedit'
[edit]='editparams'></e-column>
</e-columns>
</ejs-grid>
</div> |
Thank you that worked great.