question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to select row programmatically?

See original GitHub issue

Is there a way to select row programmatically? As far as I can see, there’s no API for it in ng2-smart-table component.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:18
  • Comments:16

github_iconTop GitHub Comments

2reactions
DependencyHellcommented, May 28, 2018

maybe something like this :

import {ViewChild} from '@angular/core';
import {Ng2SmartTableComponent} from 'ng2-smart-table/ng2-smart-table.component';
...

@ViewChild('table') table: Ng2SmartTableComponent;

...

myFunction() {
  this.table.grid.getRows().forEach((row) => {
      this.table.grid.selectRow(row);
      //or :
      this.table.grid.multipleSelectRow(row);
  });
}

set a name to the table :

<ng2-smart-table #table [settings]="settings" [source]="source">
</ng2-smart-table>
1reaction
ClemAntocommented, Apr 30, 2020

maybe something like this :

import {ViewChild} from '@angular/core';
import {Ng2SmartTableComponent} from 'ng2-smart-table/ng2-smart-table.component';
...

@ViewChild('table') table: Ng2SmartTableComponent;

...

myFunction() {
  this.table.grid.getRows().forEach((row) => {
      this.table.grid.selectRow(row);
      //or :
      this.table.grid.multipleSelectRow(row);
  });
}

set a name to the table :

<ng2-smart-table #table [settings]="settings" [source]="source">
</ng2-smart-table>

For version > 1.4.0 you have to replace your Ng2SmartTableComponent import with:

import { ɵbo as Ng2SmartTableComponent } from 'ng2-smart-table';

https://github.com/akveo/ng2-smart-table/issues/1055#issuecomment-563971309

Read more comments on GitHub >

github_iconTop Results From Across the Web

Selecting Rows and Cells Programmatically - RadGridView
This article shows how you can select rows and cells programmatically. ... To select multiple rows programmatically, set their IsSelected property to true...
Read more >
How to select a row programmatically or bind ... - Syncfusion
Query 1 : I'd like to select multiple values on initialization. && Also I tried to use the Grid.SelectCells(object) method, to set the...
Read more >
iphone - Select tableview row programmatically - Stack Overflow
UITableView's selectRowAtIndexPath:animated:scrollPosition: should do the trick. Just pass UITableViewScrollPositionNone for scrollPosition and the user won't ...
Read more >
Best approach to selecting a row programmatically on a grid ...
I may have found a way by using the (loadedRows)=“loadedRows(grid,$event)” on the grid and then selecting the rows using that approach. I will ......
Read more >
How can I programmatically select every newly added row in a ...
I have a button set up that adds a new row to my data grid. I have tried DataGridView1.CurrentCell = DataGridView1.Rows(DataGridView1.Rows.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found