|
<ej-grid #grid [dataSource]='data' [editSettings]='editSettings' [toolbar]='toolbar'(actionBegin)='Begin($event)'>
<e-columns>
<e-column headerText='Employee Image' width='150' [allowEditing] =false textAlign='center'>
<ng-template #template let-data>
<ej-checkbox #checkbox [checked]="false"></ej-checkbox>
</ng-template>
</e-column>
<e-column field='OrderID' headerText='Order ID' width='125' textAlign='right'></e-column>
<e-column field='ShipCity' headerText='Ship City' width='120'></e-column>
</e-columns>
</ej-grid>
[Component.ts]
Begin(args){
if(args.requestType === 'beginEdit' && args.row.querySelectorAll('input[type="checkbox"]')[0].checked)
{alert("You cant edit this row")
args.cancel = true;//args.cancel will prevent the editing operation
}
} |
|
let grid: Grid = new Grid({
dataSource: data,
columns: [
{
headerText: 'Order Status',
template:
`<input id="checked" type="checkbox" class="e-control e-checkbox">`, width: 140
},
{ field: 'OrderID', headerText: 'Order ID', textAlign: 'right', width: 100 },
],
height: 315,
rowDataBound: dataBound
});
grid.appendTo('#Grid');
function dataBound(args: QueryCellInfoEventArgs): void {
let ele: HTMLSelectElement =args.row.querySelector('input[type=checkbox]');
let checkBoxObj: CheckBox = new CheckBox({ checked: false});
checkBoxObj.appendTo(ele);
} |