|
<ejs-grid id="Grid" allowPaging="true" load="onLoad" dataBound="dataBound" rowDataBound="rowBound" toolbar="@( new List<object>() {"Add","Edit","Delete","Update","Cancel"})">
<e-grid-pageSettings pageCount="5" pageSize="5"></e-grid-pageSettings>
<e-grid-columns>
. . .
<e-grid-column headerText="Completed" template="#temp" width="150" allowEditing="false"></e-grid-column>
<e-grid-column headerText="Manage Records" width="150" commands="commands"></e-grid-column>
</e-grid-columns>
</ejs-grid>
<script>
function dataBound(e) {
var ele = document.getElementsByClassName("e-grid")[0]
ele.addEventListener('click', function (args) { //click event for command button
if (args.target.classList.contains('e-details')) {
var rowObj = grid.getRowObjectFromUID(ej.base.closest(args.target, '.e-row').getAttribute('data-uid'));
var value = rowObj.data;
// getting the checkbox state
value.Verified = grid.getRows()[1].getElementsByClassName('e-tchk')[0].ej2_instances[0].checked;
var options = new ej.base.Ajax();
options.url = "/Index?handler=Update";
. . .
options.send(); // Ajax send for update the check state
}
});
}
function rowBound(args) {
// rendering the checkbox in template column based on the completed value
var targetEle = args.row.getElementsByClassName('e-tchk')[0];
var checkBoxObj = new ej.buttons.CheckBox({ checked: args.data['Verified'] });
checkBoxObj.appendTo(targetEle);
}
|
|
<ejs-grid id="Grid" allowPaging="true" load="onLoad" dataBound="dataBound" rowDataBound="rowBound" toolbar="@( new List<object>() {"Add","Edit","Delete","Update","Cancel"})">
<e-grid-editsettings allowAdding="true" allowDeleting="true" allowEditing="true"></e-grid-editsettings>
<e-grid-pageSettings pageCount="5" pageSize="5"></e-grid-pageSettings>
<e-grid-columns>
. . .
</e-grid-columns>
</ejs-grid>
<script>
function onLoad() {
// you can check the condition here
index.forEach((e) => {
this.columns[e].allowEditing = false;
})
</script>
|