Hello,
When I drop a column in the group area can I choose to hide it completely instead of grouping by it?
I have some columns that I do not want to group by but I want the user to be able to hide them if they want.
Thanks in advance
<ejs-grid id="Grid" dataSource="ViewBag.dataSource" actionBegin="begin" allowGrouping="true" allowPaging="true" >
<e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true"></e-grid-editSettings>
<e-grid-pagesettings pageCount="5"></e-grid-pagesettings>
<e-grid-columns>
. . . . . . . .
. . . . . . . .
. . . . . . . .
</e-grid-columns>
</ejs-grid>
function begin(args) {
if (args.requestType == 'grouping') {
this.groupModule.groupSettings.showDropArea = false;
}
}
|
Hi Rajapandi Ravi,
I am sorry I think I explained poorly what I want.
I want the Drop Area to be visible. Also I want the user to be able to drag and drop columns in that drop area.
When a column is in that drop area the grid is being grouped by that column right? But I have some columns that I do not want to group by for example Id, and I want the user to hide them if they want. I thought what If I just hide the column when I drop them in that drop area. For example, can I somehow allowGrouping = false and also be able to drag and drop the column in the drop area. The group area to act like a list of columns for the user to add or remove.
Is this possible?
Thank you, Theofilos
<script>
var arr = ["ShipCountry", "CustomerID"]
function begin(args) { //actionBegin event of Grid
if (args.requestType == 'grouping') {
if (arr.includes(args.columnName)) {
args.cancel = true; //prevent the grouping action
var index = this.groupModule.groupSettings.columns.indexOf(args.columnName);
this.groupModule.groupSettings.columns.splice(index, 1); //delete the hidden column in groupsettings
this.getColumnByField(args.columnName).visible = false;
this.refreshColumns();
}
}
}
</script>
|