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

Position in second row thead #297

Closed
felipekoblinger opened this issue Mar 18, 2016 · 6 comments
Closed

Position in second row thead #297

felipekoblinger opened this issue Mar 18, 2016 · 6 comments

Comments

@felipekoblinger
Copy link

Hi!
I didn't find a way (without hard coding) to put filters in second row (tr) of thead.

There is a way to this in options?

Example:

<table>
  <thead>
    <tr>
      <th>Test</th>
    </tr>
    <tr>
      <!-- Filters  here !-->
      <th></th>
    </tr>
  </thead>

  <tbody></tbody>
  <tfoot></tfoot>

</table>
@vedmack
Copy link
Owner

vedmack commented Mar 19, 2016

provide a minimal sample on jsbin and I'll try to see what can be done

@felipekoblinger
Copy link
Author

Sorry, vedmack. I made the jsbin and was working perfectly there.
I figured out that the option "orderCellsTop" as true in DataTable was messing the position.

Now everything is working!

Thanks for this great plugin.

@vedmack
Copy link
Owner

vedmack commented Mar 20, 2016

Another reason to provide a test case along with the Q`

@felipekoblinger
Copy link
Author

Hi again, Vedmack.
I figured out the problem. I can't find a way to put first row as orderable and second row as filter inputs, without hard-coding.

In this example (https://jsbin.com/fahehihale/edit?html,js,output) the "orderCellsTop: true" is enabled and the first row of thead is orderable (can click to order asc or desc) along with filter inputs (second row is blank). If I set to false in orderCellsTop, everything shows perfectly, but, the orderable click is in second row instead of first row.

So I've just set this line code:

filter_selector_string = table_selector + ' ' + filters_position + ' tr:eq(' + $(unique_th[column_position]).parent().index() + ') th:eq(' + $(unique_th[column_position]).index() + ')';

to

filter_selector_string = table_selector + ' ' + filters_position + ' tr:eq(' + 1 + ') th:eq(' + $(unique_th[column_position]).index() + ')';

And now works first row orderable click and second row filters. I know this is horrible solution, but a quick one to me.

Thanks again.

@vedmack
Copy link
Owner

vedmack commented Apr 2, 2016

fixed in 0.9.0.beta.14 see sample

usage is via global property filters_tr_index

@vedmack vedmack closed this as completed Apr 2, 2016
@felipekoblinger
Copy link
Author

Thanks, vedmack! 👍

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

No branches or pull requests

2 participants