< e-columns>
< e-column field='engineSN' headerText='PW900' textAlign='center' [width]="90" [maxWidth]="90" [customAttributes]='{class: "class1"}'> < /e-column>
< e-column field='COLUMN1_REQUIRED' headerText='ASS' textAlign='center' [width]="61" [maxWidth]="61" [customAttributes]='{class: "class1"}'> < /e-column>
< e-column field='COLUMN2_REQUIRED' headerText='RIV' textAlign='center' [width]="61" [maxWidth]="61" [customAttributes]='{class: "class1"}'> < /e-column>
< e-column field='COLUMN3_REQUIRED' headerText='GRD' textAlign='center' [width]="61" [maxWidth]="61" [customAttributes]='{class: "class1"}'> < /e-column>
< e-column field='COLUMN4_REQUIRED' headerText='BAL' textAlign='center' [width]="61" [maxWidth]="61" [customAttributes]='{class: "class1"}'> < /e-column>
< e-column field='COLUMN5_REQUIRED' headerText='ASS' textAlign='center' [width]="61" [maxWidth]="61" [customAttributes]='{class: "class1"}'> < /e-column>
< e-column field='COLUMN6_REQUIRED' headerText='INTER' textAlign='center' [width]="61" [maxWidth]="61" [customAttributes]='{class: "class1"}'> < /e-column>
< e-column field='COLUMN7_REQUIRED' headerText='FINAL' textAlign='center' [width]="61" [maxWidth]="61" [customAttributes]='{class: "class1"}'> < /e-column>
< e-column field='COLUMN8_REQUIRED' headerText='ASS' textAlign='center' [width]="61" [maxWidth]="61" [customAttributes]='{class: "class1"}'> < /e-column>
< /e-columns>
this.stackedHeaderRows = [{
stackedHeaderColumns:
[
{ headerText: "SECTION 1", column: "COLUMN1_REQUIRED,COLUMN2_REQUIRED,COLUMN3_REQUIRED,COLUMN4_REQUIRED" },
{ headerText: "SECTION 2", column: "COLUMN5_REQUIRED,COLUMN6_REQUIRED,COLUMN7_REQUIRED,COLUMN8_REQUIRED" }
]
}];
< e-column headerText='ASS' textAlign="Center" [customAttributes]='{class: "class1"}'>
< ng-template #template let-data>
< div>
< ejs-checkbox #checkbox [checked]='data.COLUMN1_REQUIRED'> < /ejs-checkbox>
< /div>
< /ng-template>
< /e-column>
< e-columns>
< e-column field='engineSN' headerText='PW900' textAlign="Center" [customAttributes]='{class:"class1"}' [width]="90" [maxWidth]="90"> < /e-column>
< e-column headerText='SECTION 1' textAlign="Center" [columns]='Section1Column' [customAttributes]='{class: "class1"}'> < /e-column>
< e-column headerText='SECTION 2' textAlign="Center" [columns]='Section2Column' [customAttributes]='{class: "class1", rowspan: 2}'> < /e-column>
< /e-columns>
this.Section1Column = [
{
field: 'HP TURBINE',
headerText: 'HP TURBINE',
textAlign: 'Center',
customAttributes: { class: 'middleHeaderFormattingWithLeftBorder' },
columns: [
{field: 'COLUMN1_REQUIRED', headerText: 'ASS', width: '60', textAlign: 'Center', maxWidth: 60, customAttributes: { class: 'class1' } },
{field: 'COLUMN2_REQUIRED', headerText: 'RIV', width: '60', textAlign: 'Center', maxWidth: 60, customAttributes: { class: 'class1' } },
{field: 'COLUMN3_REQUIRED', headerText: 'GRD', width: '60', textAlign: 'Center', maxWidth: 60, customAttributes: { class: 'class1' } },
{field: 'COLUMN4_REQUIRED', headerText: 'BAL', width: '60', textAlign: 'Center', maxWidth: 60, customAttributes: { class: 'class1' } }
]
},
{
field: 'HP ROTOR',
headerText: 'HP ROTOR',
textAlign: 'Center',
customAttributes: { class: 'middleHeaderFormattingWithLeftBorder' },
columns: [
{field: 'COLUMN5_REQUIRED', headerText: 'ASS', width: '60', textAlign: 'Center', maxWidth: 60, customAttributes: { class: 'class1' } },
{field: 'COLUMN6_REQUIRED', headerText: 'INT', width: '60', textAlign: 'Center', maxWidth: 60, customAttributes: { class: 'class1' } },
{field: 'COLUMN7_REQUIRED', headerText: 'FINAL', width: '60', textAlign: 'Center', maxWidth: 60, customAttributes: { class: 'class1' } }
]
}
];
this.Section2Column = [
{
field: '-',
headerText: '-',
textAlign: 'Center',
customAttributes: { class: 'middleHeaderFormattingHidden' },
columns: [
{field: 'COLUMN8_REQUIRED', headerText: 'ASS', width: '60', textAlign: 'Center', maxWidth: 60, customAttributes: { class: 'class1' } }
]
}
];
< e-column headerText='ASS' textAlign="Center" [customAttributes]='{class: "class1"}'>
< ng-template #template let-data>
< div>
< ejs-checkbox #checkbox [checked]='data.COLUMN1_REQUIRED'> < /ejs-checkbox>
< /div>
< /ng-template>
< /e-column>
this.Section2Column = [
{
field: '-',
headerText: '-',
textAlign: 'Center',
customAttributes: { class: 'middleHeaderFormattingHidden' },
columns: [
{field: 'COLUMN8_REQUIRED', headerText: 'ASS', width: '60', textAlign: 'Center', maxWidth: 60, customAttributes: { class: 'COLUMN8_REQUIRED' ? 'class1' : 'class2' } }
]
}
];





|
[app.component.ts]
...
export class AppComponent {
...
public ngOnInit(): void {
...
this.orderColumns = [
{
...
},
{ field: 'Verified', headerText: 'Verified', width: 150, template: '#template' }
];
...
];
}
queryCellInfo(args: any): void {
if (args.column.field == 'Verified') {
var checkbox = new CheckBox({
});
if (args.data.Verified) {
checkbox.checked = true;
args.cell.classList.add('colorcheck')
}
checkbox.appendTo(args.cell.getElementsByTagName("input")[0]);
}
}
} |
|
[index.html]
<style>
.e-grid td.e-rowcell.e-templatecell.colorcheck {
background-color: yellow !important;
}
</style> |
queryCellInfoEventArgs(args: QueryCellInfoEventArgs) {
if (args.column.field !== 'enginePrefix' && args.column.field !== 'engineModel' && args.column.field !== 'actions') {
const checkbox = new CheckBox({});
if (args.data[args.column.field]) {
checkbox.checked = true;
}
checkbox.appendTo(args.cell.getElementsByTagName('input')[0]);
args.cell.getElementsByTagName('input')[0].onchange = function() {
// UPDATE BACKEND DATABASE...
};
}
if (args.column.field === 'engineModel') {
args.cell.getElementsByTagName('input')[0].value = args.data['engineModel'];
args.cell.getElementsByTagName('input')[0].onblur = function() {
// GIVES AN EMPTY STRING...
console.log(args.cell.getElementsByTagName('input')[0].value);
};
}
}

|
checkboxChange (e: any) {
alert('isChecked:' + e.checked);
console.log ('checkbox, row and column info');
console.log(e );
console.log(this.grid.getRowInfo(e.event.target));
// UPDATE BACKEND DATABASE...
}
queryCellInfo(args: any): void {
if (args.column.field == 'Verified') {
const checkbox = new CheckBox({
checked : args.data.Verified,
change: this.checkboxChange.bind(this)
});
checkbox.appendTo(args.cell.getElementsByTagName("input")[0]);
}
}
|