predixdesignsystem / px-data-grid

Predix UI component which defines a data grid
https://www.predix-ui.com/#/elements/px-data-grid
Apache License 2.0
12 stars 20 forks source link

activeItem observer is not working #786

Closed usharanitalatala closed 6 years ago

usharanitalatala commented 6 years ago

Hi,

"activeItem" will be set if a row is selected?

If yes, I am using below snippet but activeItem observer is not working. Could you please check?

`<px-data-grid selection-mode="single" active-item="{{activeItem}}"
table-data="{{repos}}" hide-action-menu = "true" columns='[[coloums]]'

        ></px-data-grid>`

properties: activeItem:{
observer: '_activeItemChanged' },

        _activeItemChanged(item){
            console.log("item changed");
        }

or window.addEventListener('selected-items-changed', (e) => this.handleKick(e)); window.addEventListener('active-item-changed', (e) => this.handleKick(e)); are also not working.

davidrleonard commented 6 years ago

A few things to note:

Here's demo code showing how to listen to selectedItems changing: https://glitch.com/edit/#!/glimmer-eyeliner?path=public/src/data-grid-demo.html:59:76

Here's that code running, open your console and select a few items to see the console.log result: https://glimmer-eyeliner.glitch.me/

usharanitalatala commented 6 years ago

Thank you David but in our case selection mode is none so the above approach wont work. When I use vaadin grid active items it works as expected. Could you please suggest what is the best approach to handle row click event if the selection mode is none?

Reason why we are using selection mode is none is to match with wireframes.

6palace commented 6 years ago

Hey @davidrleonard we are running into this problem as well, we are trying to capture the last clicked item, but activeItem is always null, active-item-changed is never being fired.

It appears that vaadin-grid's activeItem functionality isn't working, since on selection-mode='none', clicking a row should still set it to active, but nothing of the sort is happening.