How to add css class for first cell of some column (wj-pivot-grid)

Posted by: whity on 23 July 2018, 12:05 am EST

    • Post Options:
    • Link

    Posted 23 July 2018, 12:05 am EST

    Hi!

    For example I have ‘Results’ column. When I click some cell, pivot add class .wj-state-selected. But I want to have that class when the pivot is created - by default. Unfortunately I dont know how to get the name of cell column, to write condition.

  • Posted 23 July 2018, 11:44 pm EST

    Hi,

    If you want the pivot-grid to have a default selection then you may assign a default value to selection property of pivot-grid.

    //please refer to following code snippet

    pivot.selection=new wijmo.grid.CellRange(0,1);

    You may also refer to the following sample:-

    https://stackblitz.com/edit/js-ihv6lg?file=index.js

    ~Manish

  • Posted 25 July 2018, 8:53 pm EST

    Thank you Manish!

    One more question. I have a lot of pivots in my application based on Angular 5. How can I identify a specific one and apply above solution only to that one?

  • Posted 27 July 2018, 3:49 am EST

    Hi,

    In angular2+ applications you may use angular’s template referance variable to distinguish b/w pivot grids.

    Please refer to following code snippet:-

    <wj-pivot-grid  
    	#pivotGrid /* define template ref var */
    	(initialized)="initPivot(pivotGrid)" /*pass template ref to init method */
    	[itemsSource]="thePanel"
    	[showSelectedHeaders]="'All'">
    </wj-pivot-grid>
    

    In equivalent initPivot() method:-

    initPivot(pivot){
    	/*do something with pivot instance */
    }
    
    

    You may also refer to the following sample which implements the same:-

    https://stackblitz.com/edit/angular-ozpkxd?file=src%2Fapp%2Fapp.component.html

    ~Manish

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels