mleibman / SlickGrid

A lightning fast JavaScript grid/spreadsheet
http://wiki.github.com/mleibman/SlickGrid
MIT License
6.81k stars 1.98k forks source link

Slickgrid.onSelectedRowsChanged undefined values in getData() when last record is half visible #984

Closed frendcarlo closed 10 years ago

frendcarlo commented 10 years ago

I got an undefined values when i get data using args.grid.getData() during the onSelectedRowsChanged event. But when I use the onClick() event, the args.grid.getData() is complete. I use the onSelectedRowsChanged event because users sometimes use a keyboard instead of a mouseclick. Is there another event that I can use to extract the selected data? I use the extracted data when a popup detail view is present. This only happen when the selected row is at the last viewable record, and when pressed down key, the next viewable record is on the top.

6pac commented 10 years ago

The onClick event passes args like this: trigger(self.onClick, {row: cell.row, cell: cell.cell, grid: self}, e); whereas the onSelectedRowsChanged uses: trigger(self.onSelectedRowsChanged, {rows: getSelectedRows()}, e);

You can either just use args.rows (which is an array of selected row indexes), or use a direct reference to the page-level SlickGrid object or its datasource.

frendcarlo commented 10 years ago

Thanks for your reply. I ended up by adding extra event after getting data which is not that wise but it works..