Griddle
Griddle copied to clipboard
How to get selected items from grid using checkbox
Hi,
I'm using isMultipleSelection and uniqueIdentifier properties to select items. But, I couldn't find how to get those selected items.
Could you please provide me how to get selected items ids from grid using checkbox.
Thanks, Rakesh
Hi,
Can't seem to find any documentation on isMultipleSelection and uniqueIdentifier properties. Can you point me in direction of where these properties are documented?
@mlubovac I too couldn't find any documentation on isMultipleSelection and uniqueIdentifier properties. But, I have implemented functionality using those properties and it worked as per my needs.
Can you provide an example of how to use such properties?
Following is the code to create grid with isMultipleSelection and uniqueIdentifier properties
<GriddleDataGrid ref='griddleGrid' showFilter={true} results={datasource} resultsPerPage={5} columnMetadata={this.columnMetadataDialog} columns={this.columnIdentitiesDialog} useGriddleStyles={false} tableClassName='table table-striped' useCustomPagerComponent={false} infiniteScrollLoadTreshold={5} useFixedHeader={true} isMultipleSelection={true} uniqueIdentifier='someUniqueValue' bodyHeight={300} />;
Here 'someUniqueValue' is a unique value property in your data source.
Using ref of react you can access the selected values in the grid. Syntax would be, this.refs.griddleGrid.getSelectedRowIds().
Also, you can store selectedRowIds in your own state and pass them into the selectedRowIds
prop. onSelectionChange
prop can be used to pass a function to be run when selectedRowIds change. Set state inside that function.