Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support set column object and retrive column index #155

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

andrewillard
Copy link

@andrewillard andrewillard commented Oct 10, 2016

I created this PR to make avaialable columnIndex binding beforeCellBind and support set column item when is creating a dynamic column, like:

  <iron-data-table id="table" items="{{items}}">
    <data-table-column name="Fixed Column">
      <template>
        <foo></foo>
       </template>
    </data-table-column>
    <template is="dom-repeat" items="{{dynamicColumns}}" as="columnItem">
      <data-table-column column-item="{{columnItem}}">
        <template is="header">
          <bar></bar>
        </template>
        <template>
          <foo></foo>
        </template>
      </data-table-column>
    </template>
  </iron-data-table>

This change is Reviewable

@gabrielle-perez-movile
Copy link

Ow, this is the solution I was looking for...

@notnotgabriel
Copy link

Thanks to perform this solution bro.

@Saulis
Copy link
Owner

Saulis commented Oct 21, 2016

Hi there! Sorry for the delay!

The columnIndex looks like a nice addition, thanks!

However, I'm not sure if the columnItem is needed – since all the column properties are available inside beforeCellBind(data, cell) by using data.column.foo right? Or am I missing something?

@andrewillard
Copy link
Author

Hi Saulis, no problem, thanks for your attention!

I suggested columnItem because today we only have row item available to use two way data bind, there aren't a collection items for columns as we have for rows, because we always have created static columns until now. :) I don't know if is possible solve this using beforeCellBind, do you know?

For dynamic columns we need to set what column item we want to use in two way data bind for each data-table-column.
If it isn't look good, what do you think about create a new element like data-table-columns with items property, so we can do a dom-repeat inside the element instead do it outside?

Thanks again.

@Saulis
Copy link
Owner

Saulis commented Oct 27, 2016

@andrew-silva-movile hmm not sure if I'm missing something.. can you post some example code for the use case?

The reason why I'm a bit confused is that in the PR the only change that columnItem property makes is that it will be available through cell.columnItem inside beforeCellBind(data, cell) right? However, you can already access the same property today by using data.column.columnItem without adding any new bindings?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants