We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

i want to show/hide command column based on session storage in typescript

Thread ID:

Created:

Updated:

Platform:

Replies:

142488 Feb 6,2019 09:19 AM UTC Feb 7,2019 11:34 AM UTC Angular 1
loading
Tags: ejGrid
Muthukumar
Asked On February 6, 2019 09:19 AM UTC

HI Team ,

I want to hide the command column based on session storage value in EJ1 ejgrid controls with typescript and web api.






Thanks,
Divakaran N

Vignesh Natarajan [Syncfusion]
Replied On February 7, 2019 11:34 AM UTC

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  
 
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;