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.

userRowSelect don't work on first click

See original GitHub issue

It seems that in every first click in the grid, the userRowSelect event simply gets ignored. The next clicks (in any rows) work as expected.

No error is fired. This issue happens with any rows (first click in any row don’t trigger, then next clicks in any rows start to work normally).

View code
<ng2-smart-table [settings]="settings" [source]="gridSource" (userRowSelect)="handleGridSelected($event)"></ng2-smart-table>
Controller code
export class NiveisListarComponent extends CRUD implements OnInit {
  gridSelected;
  gridSource: LocalDataSource;
  gridData: object[];
  settings = Grid.basicConfigWithName();

  constructor(
    router: Router
  ) {
    super(router);
  }

  ngOnInit() {
    this.getDataFromAPI();
  }

  handleGridSelected(event) {
    this.gridSelected = event.selected[0];
    console.log(this.gridSelected);
  }

  getDataFromAPI() {
    this.Request.get(this.URL_CRUD_ENDPOINT)
    .then((res) => {
      this.gridData = res.data;
      this.gridSource = new LocalDataSource(this.gridData);
      this.gridSource.refresh();
    });
  }
}
Package.json dependencies (pkg versions)
"dependencies": {
    "@angular/common": "^4.0.0",
    "@angular/compiler": "^4.0.0",
    "@angular/core": "^4.0.0",
    "@angular/forms": "^4.0.0",
    "@angular/http": "^4.0.0",
    "@angular/platform-browser": "^4.0.0",
    "@angular/platform-browser-dynamic": "^4.0.0",
    "@angular/router": "^4.0.0",
    "angular-2-dropdown-multiselect": "^1.4.2",
    "animate.css": "^3.5.2",
    "axios": "^0.16.2",
    "core-js": "^2.4.1",
    "diacritics": "^1.3.0",
    "ng2-smart-table": "^1.2.1",
    "tinymce": "^4.6.4"
  },
  "devDependencies": {
    "@angular/cli": "^1.2.1",
    "@angular/compiler-cli": "^4.0.0",
    "@types/jasmine": "2.5.38",
    "@types/node": "~6.0.60",
    "codelyzer": "~2.0.0",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "jeet": "^7.1.0",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.0.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "node-sass": "^4.5.3",
    "protractor": "~5.1.0",
    "sass-loader": "^6.0.5",
    "ts-node": "~2.0.0",
    "tslint": "~4.5.0",
    "typescript": "~2.2.0"
  }

Visual reproduction of the bug:

(First click don’t fire the event, then next clicks work normally) grid-bug

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:14

github_iconTop GitHub Comments

9reactions
bhaveshshahcommented, Oct 25, 2017

As of now we can solve the issue by

HTML : <ng2-smart-table [settings]="settings" [source]="gridSource" (userRowSelect)="handleGridSelected($event)" #grdTags></ng2-smart-table>

TS: @ViewChild('grdTags') grdTags;

After Grid Initialization.

this.grdTags.grid.dataSet.willSelect = 'false';

though this is not a valid way to do but at least its stopping the first row auto selection, till the time the devs are fixing it this can help us to move the code to production.

1reaction
sanathpathirajacommented, Mar 7, 2019

@bhaveshshah nice work

Read more comments on GitHub >

github_iconTop Results From Across the Web

ng2-smart-table on click row should highlighted - Stack Overflow
i am using angular 7 and when i click on any row in ng2-smart-table row not get highlighted e.g change colour of of...
Read more >
Developers - userRowSelect don't work on first click - - Bountysource
Coming soon: A brand new website interface for an even better experience!
Read more >
Issues with Row Selector Click of Ultragrid - Forums - Infragistics
I dont want to display the row connectors for parent rows(siblings). I only want to display the row connector between a parent and...
Read more >
Ng2Smarttable Set Click Event Only For Last Column - ADocLib
It seems that in every first click in the grid the userRowSelect event simply gets ignored.The next clicks in any rows work as...
Read more >
Agents Performance Summary view
In the user's row, select the check box. Continue selecting user check boxes to add to filters. Click Add to filters. To use...
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