super-elements / super-grid

0 stars 0 forks source link

How do we give Column Definitions? #10

Open prakash1517 opened 7 years ago

prakash1517 commented 7 years ago

How does a developer give definitions for a column?

A Custom <super-column>

We could use an element like <super-column> with custom attributes. Eg:

  <super-column header="Name" data="{{data.name}}" width="25%">
    <template> {{data.name.fullName}} </template>
  </super-column>

Table Headers

We could also use standard HTML tables with <th> in <thead>.

<thead>
  <tr>
    <th data-header="Name" data-value="{{data.name}}" data-width="25%">
      <template> {{data.name.fullName}} </template>
    </th>
  </tr>
</thead>

Parsing Column Structure

Now our task is reduced to looping through all <super-column> (or <thead>) in the element's <content> and creating a <template> within the <iron-list> with an appropriate structure as defined in #4 and #2 .

gaurav21r commented 7 years ago

@prakash1517 Sounds good! :+1:

I am inclined towards the super-column approach because we will get User API Documentation for free when we create this element. But will this be an empty element? If it will actually have code (besides the element property definition) what will it have?

Also, what happens to this element once the grid is rendered? Does it stay there somewhere in a <template> ? @prakash1517 Please research what happens in other grids?

Namely, <hot-table> and <vaadin-grid>