|
App.component.ts
let grid: Grid = new Grid(
{
dataSource: employeeData,
allowSelection: true,
rowSelecting: function (args) {
if((args.data as any).EmployeeID%2=== 0) { //Based on condition
args.cancel = true;
}
},
columns: [
. . . . . . .
. . . . . . .
}
]
});
grid.appendTo('#Grid');
|
|
Note: In our Grid, we don’t have the support to select the column. We only have rowSelection.
|
|
let colindex = 0;
let grid: Grid = new Grid(
{
dataSource: employeeData,
allowSelection: true,
rowSelecting: function (args) {
colindex = +(args.target as any).getAttribute('aria-colindex'); //get the column index
if(grid.getColumnByIndex(colindex).field === "FirstName") {
args.cancel = true;
}
},
columns: [
{ field: 'EmployeeID', headerText: 'Employee ID', textAlign: 'Right', width: 135 },
{ field: 'FirstName', headerText: 'FirstName', width: 125 },
{ field: 'Title', headerText: 'Title', width: 180 },
{
field: 'HireDate', headerText: 'Hire Date', textAlign: 'Right',
width: 135, format: { skeleton: 'yMd', type: 'date' }
}
]
});
grid.appendTo('#Grid');
|