var grid = new ej.grids.Grid({
dataSource: window.employeeData,
allowSelection: true,
selectionSettings: { cellSelectionMode: 'Box', type: 'Multiple', mode: 'Cell' },
dataBound:(args)=>{
grid.selectCell({ rowIndex: 0, cellIndex: 0 });
},
enableHover: false,
columns: [
{ field: 'EmployeeID', headerText: 'Employee ID', textAlign: 'Right', width: 135 },
]
});
grid.appendTo('#Grid');
|
Index.html
<script id="template" type="text/x-template">
<a id="temp" rel='nofollow' href="#" class='customTemplate' onclick='viewPatientDetail(this)'>${EmployeeID} </a>
</script>
<script>
function viewPatientDetail(args){
alert('Hi')
}
</script>
var grid = new ej.grids.Grid({
selectionSettings: { cellSelectionMode: 'Box', type: 'Multiple', mode: 'Cell' },
dataBound: (args) => {
grid.selectCell({ rowIndex: 0, cellIndex: 0 });
},
columns: [
{
headerText: 'Employee Image', textAlign: 'Center',
template: '#template', width: 150
}],
width: 'auto',
height: 359
});
grid.appendTo('#Grid');
document.getElementById('Grid').addEventListener('keydown', function (args) {
if (args.target.classList.contains('customTemplate') && args.keyCode === 13) {
args.target.click()
}
})
|