|
<script type="text/javascript">
$(function () {
$("#Grid").ejGrid({
// the datasource "window.gridData" is referred from jsondata.min.js
dataSource: window.gridData,
allowPaging: true,
selectionType: "multiple",
selectionSettings: { selectionMode: ["row"] },
columns: [
{ field: "OrderID", headerText: "Order ID", isPrimaryKey: true, textAlign: ej.TextAlign.Right, width: 75 },
. . .
{
headerText: "Manage Records",
commands: [
{ type: ej.Grid.UnboundType.Edit, buttonOptions: { text: "Edit" } },
],
isUnbound: true,
width: 130
}
],
rowSelecting: function (args) {
if (this.getSelectedRecords().length) {
var len = this.model.columns.length
for (var i = 0; i < len; i++) {
if (this.model.columns[i].isUnbound) {
var column = args.model.columns[i];
column.visible = false; //set visible false
this.columns(column, "update"); //using columns method to change the properties of the column
}
}
}
}
});
});
</script> |
|
<body>
<div class="content-container-fluid">
<div class="row">
<div class="cols-sample-area">
<div id="Grid"></div>
</div>
</div>
</div>
<script type="text/javascript">
$(function () {
$("#Grid").ejGrid({
// the datasource "window.gridData" is referred from jsondata.min.js
dataSource: window.gridData,
allowPaging: true,
columns: [
. . . .
{ field: "Verified", headerText: "Verified", editType: ej.Grid.EditingType.Boolean, width: 75 },
{
headerText: "Manage Records",
commands: [
{ type: "edit", buttonOptions: { text: "Edit" } },
{ type: "delete", buttonOptions: { text: "Delete" } },
{ type: "Undo delete", buttonOptions: { text: "Clear" } },
{ type: "save", buttonOptions: { text: "Save" } },
{ type: "cancel", buttonOptions: { text: "Cancel" } },
],
isUnbound: true,
width: 130
}
],
rowSelected: function (args) {
if (this.getSelectedRecords().length > 1) {
$(args.row).find(".e-unboundcelldiv .e-editbutton").ejButton("disable");
}
else {
$(args.row).find(".e-unboundcelldiv .e-editbutton").ejButton("enable");
}
},
rowDeselected: function (args) {
$(args.row).find(".e-unboundcelldiv .e-editbutton").ejButton("enable");
}
});
});
</script>
</body> |