Saulis / iron-data-table

iron-data-table is a Web Component for displaying data as a table or grid. Built on top of iron-list using Polymer.
Apache License 2.0
147 stars 66 forks source link

Item expanding event is not fired when using custom expand toggle #145

Closed web-padawan closed 7 years ago

web-padawan commented 8 years ago

I use a custom expand toggle element bound to {{expanded}} property, without details-expanded attribute (because I only need to show details when clicking on element, not the whole row). But expanding-item event is not fired due to this row:

if (this.rowDetail && this.detailsEnabled) {

Maybe instead of firing this event inside of click handler we should observe expanded?

      _expandedChanged: function (expanded, oldExpanded) {
        if (expanded === true && oldExpanded === false) {
          console.log('expanded');
        } else if (expanded === false && oldExpanded === true) {
          console.log('collapsed');
        }
      }
Saulis commented 8 years ago

Hi!

Yeah, the expanding-item is supposed to be fired only when user has clicked on a row to expand it. I guess we should make _expandedItems public and put notify: true on it.

Saulis commented 7 years ago

@web-padawan could you try out how expose-expanded-items branch work for you? expandedItems is now public and you should be able to observe that for changes.

web-padawan commented 7 years ago

Thanks, I'll take a look.

Saulis commented 7 years ago

@web-padawan any luck?

web-padawan commented 7 years ago

Looks good, but what if someone changes expanedItems from outside? I already implemented this in brainy-table, however. Will debug there. Will close the issue now, it's up to you to make a decision.