Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
260
Automatically hide specific columns with IgxGridToolbar columnHiding
posted

Hello,

Is it possible to turn [columnHiding] on when using [showToolbar] and set a default that hides some columns on the grid? If so, please provide an example.

Thanks!

Parents
  • 1320
    Verified Answer
    Offline posted

    Hello Jason,

    After investigating this further, I determined that if the toolbar is not enabled, enabling the columnhiding property will have no effect. However showToolbar and columnHiding could be set to the grid using variables, set in the ts file. And in the ngOnInit() if showToolbar is enabled, then to set columnHiding to true.

    Regarding default hidden columns, this could be achieved by adding hidden property set to true, to any of the columns:

    <igx-column [field]="'CompanyName'" [header]="'Company Name'" [hidden]="true">

    A column could also be hidden in the ts file. For example a method could be bound to the onColumnInit event:

      <igx-grid . . . (onColumnInit)="initializeColumn($event)">

     and to hide column with index 0 the following way:

    public initializeColumn(evt){

        if(evt.index == 0){

          evt.hidden = true;

        }

      }

    I have prepared a sample, demonstrating the described behavior. Please test it on your side and let me know if you need additional information regarding this matter.

    Regards,

    Monika Kirkova,

    Infragistics

Reply Children
No Data