title: How to select the rows of a material table programmatically on onclick event of button -React js
body: <p>I am Working with Material-Table . I need to select multiple rows on clicking a button based on some condition .the condition is written inside the code below. Can anyone guide me on how to select multiple rows based on some condition?</p>
  <pre><code> &lt;MaterialTable
                              icons={tableIcons}title=&quot;&quot;
  
                              columns={[
                                  { title: 'Project Name', field: 'Project_Name', render: rowData =&gt; &lt;Link to='/projectdetails'&gt;{rowData.Project_Name}&lt;/Link&gt; },
                                  { title: 'Methods Covered', field: 'Methods_Covered', type: 'numeric' },
                                  { title: 'Methods not Covered', field: 'Methods_not_Covered', type: 'numeric' },
                                  { title: 'Total Methods', field: 'Total_Methods', type: 'numeric' },
  
                                      ]}
  
                              data={this.state.results}
  
  
                              components={{
                                  Toolbar: props =&gt; (
                                      &lt;div&gt;
                                          &lt;MTableToolbar {...props} /&gt;
                                          &lt;div className=&quot;Mtable&quot;&gt;
  
                                         
                                              &lt;div&gt;
                                                  &lt;Button color=&quot;primary&quot; onClick={rowData =&gt; 
                                                   (rowData.Methods_Covered ? 
                                                    rowData.tableData.checked = true : 
                                                    rowData.tableData.checked = false)}&gt;
                                                   select Highlighted&lt;/Button&gt;
                                              &lt;/div&gt;
                                              
                                          &lt;/div&gt;
                                        
                                      &lt;/div&gt;
                                  ),
                              }}
                              onSelectionChange={this.handleSelect}
                              onRowClick={this.handleRowClick}
                              options={{
                                  sorting: true,
                                  selection: true,
                                  search: true,
                                  searchAutoFocus: true,
                                  searchFieldAlignment: 'right',
                                  searchFieldStyle: {
                                      border: 'solid black 2px',
                                  },
                                }}
    /&gt;
  </code></pre>