miguelcobain / ember-yeti-table

Yeti Table
https://miguelcobain.github.io/ember-yeti-table
MIT License
61 stars 15 forks source link

table.body calls OnRowClick with different argument when its a block #448

Open bracke opened 2 years ago

bracke commented 2 years ago

Hi

In the following two examples the click_handler is called with different arguments, and I don't know why.

In the first example the click_handler is called with the row object which is what I expected. In the second example the click_handler is called with a pointer event object which is not what I expected.

Is there a way to make the second example behave like the first example?

<table.body @onRowClick={{this.click_handler}}/>

<table.body @onRowClick={{this.click_handler}} as |body person index|>
  <body.row  as |row|>
    <row.cell>
      {{person.firstName}}
      #
      {{index}}
    </row.cell>
    <row.cell>
      {{person.lastName}}
    </row.cell>
    <row.cell>
      {{person.points}}
    </row.cell>
  </body.row>
</table.body>
cah-brian-gantzler commented 2 years ago

This line https://github.com/miguelcobain/ember-yeti-table/blob/master/addon/components/yeti-table/body.hbs#L6 needs the fn call same as https://github.com/miguelcobain/ember-yeti-table/blob/master/addon/components/yeti-table/body.hbs#L16

Is that a breaking change (for those that are use to it) or considered a bug?

miguelcobain commented 2 years ago

@cah-briangantzler I think this can be considered a bug, because the docs state the following: image

More specifically the "Can be used with both the blockless and block invocations." part.

Finn10111 commented 2 years ago

@bracke Thank you for mentioning this because I ran into this issue, too. I still could not find a workaround, probably I am missing something to pass the desired id of that clicked row, I would be grateful for an update.

bracke commented 2 years ago

@Finn10111 I have still not been able to fix it. Nor found a workaround :-(

Finn10111 commented 2 years ago

Thanks a lot for your effort, meanwhile I found a simple workaround by adding a link or binding an event to a cells content which is okay for most of my use cases. But user experience would be better you just could click on the row.