0
votes

Clicking on the checkbox selects Row. How do I separate check box column selection from Row selection?..

Select all rows in the HeaderCheckbox table. How do I select only the current page Row?

Please help me...

// colDefs
{ 
    id: 'checkbox',
    checkboxSelection: true,
    headerCheckboxSelection: true,
    headerCheckboxSelectionFilteredOnly: true,
    suppressMenu: true,
    filter: false,
    floatingFilter: false,
    suppressFilter: true,                  
    floatingFilterComponentParams: { suppressFilterButton: true },
    width: 55,
    editable: false,
}

//gridOptions
{
  ...,
  rowSelection: 'multiple',
}

EDIT:

The library used is: https://www.ag-grid.com/

1
Can you add your actual code ? - Tristan De oliveira
Please edit the question to have codes. - Shakespear

1 Answers

0
votes

For your first part, you can use cellRenderer to add a checkbox to a column and then have your own logic implemented when user selects checkbox.

var defaultCols = [{
        field: "Select",
        cellRenderer: chkCellRenderFunc
    },
    {
        field: "ColumnA",
        minWidth: 80
    },
    {
        field: "ColumnB",
        width: 150
    },
    {
        field: "ColumnC",
        minWidth: 80
    }
]

function chkCellRenderFunc(params) {
    var chk = document.createElement('input');
    chk.type = "checkbox";
    chk.checked = params.data.Select;
    chk.addEventListener('change', function () {
            //Add your logic for checkbox change event 
        }
        params.api.getFilterInstance('Select').resetFilterValues();
    });
return chk;
}