K_kuz_
K_kuz_

Reputation: 16

Change color for selected rows

Could you tell me please where can I find property source (like in params for event onRowClicked) , if I call property onRowSelected. I need to change the color of the rows which I click by checkbox enter image description here

grid = {
        columnDefs: [],
        rowSelection: 'multiple',
        rowData: null,
        rowGroupPanelShow: 'always',
        getRowStyle: function (params) {                
            //some code for changing background-color
        },
        onSelectionChanged: rowSelectionChanged,
        onRowDoubleClicked: onRowDoubleClicked,
        groupSelectsChildren: false,
        onRowClicked: clickFunction,
        suppressRowClickSelection: true,
        onRowSelected: selectionChangedFunc,
        onGridReady: function() {
            this.api.hideOverlay();
        }
    };
    function selectionChangedFunc(params){
            console.log(params)    
    }

    function clickFunction(params){
            console.log(params)   
    }

Upvotes: 0

Views: 885

Answers (1)

Günter Zöchbauer
Günter Zöchbauer

Reputation: 658077

Just use the index of the highlighted item

<div *ngFor="let row of rows;let i=idx" 
    (click)="selectedRow = i"
    [class.highlighted]="i == selectedRow">{{row.data}}<div>

Upvotes: 2

Related Questions