JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Data Grid › Selection in grid
Tagged: selection
I use a checkbox selection with multiple selection.
How can I get the selected rows indexes ?
Tks
Invoke the getSelectedRowIndexes method.
const grid = document.querySelector(‘smart-grid’); const result = grid.getSelectedRowIndexes();
Best Regards, Markov
Smart UI Team https://www.htmlelements.com/
I found also a metod getSelectedRowIds.
Is there the way to declare a column ad id ?
Hi,
The column id is the ‘dataField’ property which you set to the columns.
My data field is defined as
{label : ‘Code’, dataField:’CODICE’, width:’auto’, align: ‘center’, width: ‘15%’, visible : true, allowEdit: false},
Shouid I add something to make it the id or I need to add a column named id to my columns ?
I also tried to add row.id value to each row but it seems to ignore it.
I added an id field named id.
I defined in the DataSource keyDataField : ‘id’
I defined it in columns as
{label : ‘Id’, dataField:’id’, width:’auto’, align: ‘center’, width: ‘15%’, visible : true, allowEdit: false},
I filled it.
but getSelectedRowIds() still returns the row number of the selected rows and not my id.
To set the id of the Grid, set the id property of the dataAdapter object to the dataField you want to be used as an ID.