Skip to content

Table display compromised in responsive layout #6

@wimrijnders

Description

@wimrijnders

Hi there,

I have an issue with the usage of align-column within a responsive layout.

I have a table defined as follows:

<table class="best_svm_table">
  <tbody>
    <tr class="header">
      <th>Precision</th>
      <th>Recall</th>
      <th class="hide_tablet">Accuracy</th>
      <th class="hide_tablet">Num Generic</th>
      <th class="hide_mobile">Signal To Noise</th>
      <th class="second">Iterations</th>
    </tr>
    <tr>
      <td>70.00%</td>
      <td>15.02%</td>
      <td class="hide_tablet">64.91%</td>
      <td class="hide_tablet">2</td>
      <td class="hide_mobile">0.00000</td>
      <td class="it_numbers"><a class="iteration_number">85</a></td>
    </tr>
    ...
  </tbody>
</table>

This is in a responsive layout. The classes hide_tablet and hide_mobile serve to hide given columns when the screen width drops below a certain threshold value. This worked fine before I added align-column.

After the table has been created and filled, I run:

control.find(".best_svm_table").alignColumn([0, 1, 2, 3, 4])

This converts the previous HTML-table to the following:

<table class="best_svm_table" style="border-collapse: collapse;">
  <tbody>
    <tr class="header">
      <th colspan="2">Precision</th>
      <th colspan="2">Recall</th>
      <th class="hide_tablet" colspan="2">Accuracy</th>
      <th class="hide_tablet" colspan="2">Num Generic</th>
      <th class="hide_mobile" colspan="2">Signal To Noise</th>
      <th class="second">Iterations</th>
    </tr>
    <tr>
      <td style="text-align: right; padding-right: 0px; border-right-style: none;">70</td>
      <td class="added" style="text-align: left; padding-left: 0px; border-left-style: none;">.00%</td>
      <td style="text-align: right; padding-right: 0px; border-right-style: none;">15</td>
      <td class="added" style="text-align: left; padding-left: 0px; border-left-style: none;">.02%</td>
      <td class="hide_tablet" style="text-align: right; padding-right: 0px; border-right-style: none;">64</td>
      <td class="added" style="text-align: left; padding-left: 0px; border-left-style: none;">.91%</td>
      <td class="hide_tablet" style="text-align: right; padding-right: 0px; border-right-style: none;">2</td>
      <td class="added" style="text-align: left; padding-left: 0px; border-left-style: none;"></td>
      <td class="hide_mobile" style="text-align: right; padding-right: 0px; border-right-style: none;">0</td>
      <td class="added" style="text-align: left; padding-left: 0px; border-left-style: none;">.00000</td>
      <td class="it_numbers"><a class="iteration_number">85</a></td>
    </tr>
    ...
    </tr>
  </tbody>
</table>

What is apparent, is that any cells with numbers in them are split into two cells, with extra style info for each. This works just fine in the large screen width, but as the width is decreased, the layout goes awry.

The thing here is that the added cells, marked with class="added" do not inherit the class used by the responsive layout. I.e., in order for the responsive layout to work, the sixth column of the second row in the previous code block should have read:

      <td class="hide_tablet added" ...>>.91%</td>

My request is: is it possible for the added column to inherit the original classes for a given column as well? Perhaps there's an overriding reason not to implement this, in which case I would appreciate a suggestion for a workaround.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions