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.

New Feature Request: Ability to "select" a row programmatically.

See original GitHub issue

I’m submitting a … (check one with “x”)

[ ] bug report => search github for a similar issue or PR before submitting
[ x ] feature request
[ ] support request => Please do not submit support request here, post on Stackoverflow or Gitter

Current behavior

Unable to programmatically “Select” a row. In order to perfom the “Select” operation, the user must click the row.

Expected behavior

Within the TS file, I’d like to perform a “Select” operation on a specific row, and have it “Open” the details of that row. I would like to be able to SAVE the selected row parameter, perform an update of the underlying this.rows, and then reselect the previously selected rows.

Reproduction of the problem

What is the motivation / use case for changing the behavior?

In my application, the rows display summary data for multiple months worth of information. Upon selecting a row, it opens a detailed datatable, that shows projects and values for expanded for the same months. Within the details table, users can interact with the data and update values, which commit to the database. A refresh of the original data table data will force the detail view to close. I would like to keep it open (or at the very least be able to “reselect” the record that was open in the first place).

Please tell us about your environment:

Mac, Sublime/Ultra Edit, npm, node, etc.

  • Table version: 0.8.x

11.0.2 is the current version I’m using, this is a new feature request not found in older versions.

  • Angular version: 2.0.x

5.0.1

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

All

  • Language: [all | TypeScript X.X | ES6/7 | ES5] all

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:7
  • Comments:16

github_iconTop GitHub Comments

4reactions
nhducseuitcommented, Nov 14, 2017

The DatatableComponent object should allow you to do that.

Assume that you already have object row that you want to select it from ts file, and by using @ViewChild query you able to obtain an instance of the table named datatable

In order to select the row from ts, do this:

this.datatable.selected.push(row);

In order to navigate to a page with specific selected row info, just use Angular router feature, like:

this.router.navigate(['app/detailpage', row.id]);
3reactions
Linux4evercommented, Mar 11, 2020

@edjm1971 Try look at the demo code to see how they are auto selecting the 3rd row on start. Instead of doing it on start you want to do it on map click event. https://github.com/swimlane/ngx-datatable/blob/master/src/app/selection/selection-single.component.ts

After you select the map, you need to find out which row in the table reflect the map select. And set the this.selected = [tabledata[rownumber]];

declare variable: selected = [];

My guess you have map click function(){ … // find rownumber where the data is in table this.selected = [tabledata[rownumber]]; //this should highlight your table. }

html: The import line is [selected]=“selected” which binds to selected variable. <ngx-datatable class=“material” [rows]=“rows” [columnMode]=“ColumnMode.force” [columns]=“columns” [headerHeight]=“50” [footerHeight]=“50” rowHeight=“auto” [selected]=“selected” [selectionType]=“SelectionType.single” (activate)=“onActivate($event)” (select)=“onSelect($event)”

Hope this helps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Programmatically select rows when new row is selected
The basic functionality I'm looking for is the ability to select rows together. If I have some ID with duplicates, and I want...
Read more >
WPF: Programmatically Selecting and Focusing a Row or Cell ...
The DataGrid control has a SelectionUnit property that decides whether rows, cells or both can be selected. For you to be able to...
Read more >
Selecting Rows and Cells Programmatically - RadGridView
To select multiple rows programmatically, set their IsSelected property to true : C#; VB.NET.
Read more >
Programmatically select multiple rows in List Page
Hello Mike,. Unfortunately, this is not possible to the best of my knowledge (at least with the latest version of NAV/365BC at the...
Read more >
Row Selection - JavaScript Data Grid
suppressRowClickSelection : If true , rows won't be selected when clicked. Use, for example, when you want checkbox selection or your managing selection...
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