akveo / akveo/ng2-smart-table

userRowSelect don't work on first click

Open
#462 14 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.6k
Forks
867
PR merge metrics
No merged PRs in 30d

Description

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

```html

```

Controller code

```ts
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)

```json
"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](https://user-images.githubusercontent.com/1953194/28795490-6e8eef94-7610-11e7-9d8f-cb9cbe6be1bc.gif)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.