Skip to content

support set column object and retrive column index#155

Open
andrewillard wants to merge 1 commit into
Saulis:masterfrom
andrewillard:feature/column-object
Open

support set column object and retrive column index#155
andrewillard wants to merge 1 commit into
Saulis:masterfrom
andrewillard:feature/column-object

Conversation

@andrewillard

@andrewillard andrewillard commented Oct 10, 2016

Copy link
Copy Markdown

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
Copy Markdown

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

@notnotgabriel

Copy link
Copy Markdown

Thanks to perform this solution bro.

@Saulis

Saulis commented Oct 21, 2016

Copy link
Copy Markdown
Owner

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
Copy Markdown
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

Saulis commented Oct 27, 2016

Copy link
Copy Markdown
Owner

@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