Hi Muthukumar,
Thanks for contacting Syncfusion Support.
Query: “ want to hide the command column based on session storage value in EJ1 ejgrid”
We have checked your query and based on your requirement we have get the value of session variable using window.sessionStorage and based on the variable value we have hide the columns using hideColumns() method of the Grid. You can change the session variable value while performing any actions based on your requirement.
<script>
var value = window.sessionStorage.getItem('hideColumn');
window.sessionStorage.setItem('hideColumn', true);
</script>
Grid.html:-
<button class="btn btn-primary" (click)="hideColumn();" type="button">Hide Column</button>
<ej-grid [allowPaging]="true" [allowSorting]="true" [dataSource]="gridData">
<e-columns>
<e-column headerText="Manage Records" width="75" textAlign="right">
</e-column>
</ej-grid>
Grid.ts:-
public gridData: any;
hideColumn() : any {
if(value=="true"){
var obj = $("#ejControl_0").ejGrid("instance");
obj.hideColumns("Manage Records");
}
}
constructor()
{
this.gridData = [{
. . . .
}];
}
|
Refer our API documentation for you reference
If we misunderstood your query, please get back to us with more details.
Regards,
Vignesh Natarajan