We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid multi-select, initialize with multiple selected

Thread ID:

Created:

Updated:

Platform:

Replies:

144520 May 10,2019 12:10 AM UTC May 13,2019 09:39 AM UTC React - EJ 2 1
loading
Tags: Grid
KEVIN KELLY
Asked On May 10, 2019 12:10 AM UTC

I'm trying to use the enableSimpleMultiRowSelection of the GridComponent, and want to select rows initially for my component when it renders. 

There is a selectedRowIndex which only selects 1 row according to the docs. How do I select multiple, do I have to use the underlying Javascript functionality with a databound callback?

Thavasianand Sankaranarayanan [Syncfusion]
Replied On May 13, 2019 09:39 AM UTC

Hi KEVIN, 

Greetings from Syncfusion support. 

Based on your query we suspect that you want to select multiple record in Grid when load the Grid initially. So, we suggest you to use the below code example to achieve your requirement. 

[index.js] 

import { render } from 'react-dom'; 
import './index.css'; 
import * as React from 'react'; 
import { GridComponent, Grid, ColumnsDirective, ColumnDirective, Toolbar, ColumnChooser, Inject, Page  } from '@syncfusion/ej2-react-grids'; 
import { data } from './data'; 
import { SampleBase } from './sample-base'; 
export class ColChooser extends SampleBase { 
 
    dataBound(){ 
      this.selectedRowIndices = [1,2,4]; 
      this.gridInstance.selectRows(this.selectedRowIndices); 
    } 
    constructor() { 
        super(...arguments); 
 
        this.settings = { mode: 'Row', type: 'Multiple'}; 
     
 
    } 
 
    render() { 
        return (<div className='control-pane'> 
    <div className='control-section'> 
        <GridComponent dataSource={data} ref={grid => 
            this.gridInstance = grid} dataBound={this.dataBound.bind(this)}  allowPaging={true} selectionSettings={this.settings} > 
            <ColumnsDirective> 
 
                  ----- 
 
            </ColumnsDirective> 
            <Inject services={[Page]} /> 
        </GridComponent> 
    </div> 
</div>); 
    } 
} 

  
We have prepared a simple sample in the following stackblitz link. 


Refer the help documentation. 



Regards, 
Thavasianand S. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon