Fix row 2-8
Fix row 2-8
bidon2
Posts: 20Questions: 2Answers: 0
Hello,
for some reasons i need to fix row 2 to 8 of my data table.
Row 0 to 1 is my table head.
If I call row 2 to 8 as head ( <th> ) it works but the sort function should stick to row 1.
Any chances to get an sort offset or just fix row 2-8 (as <td> )?
Thanks in advance!
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Use
orderCellsTop
to have the ordering click listeners attach to the top row in the header (by default it attaches to the bottom).Allan
great!
sorry. didnt find that option for my own
thanks!
Ok. Now I have a problem with this solution.
I want to use "Fixed Header" and row 2-8 should not get fixed on top.
I think I have to remove them from <thead>.
But how to get my sort problem solved then?
Thanks in advance!
Can you link to a page showing the issue so I can get the complete picture of what is required and what is going on?
Thanks,
Allan
Sadly I work in Intranet and have also no access to jsbin or smth else.
I'll try to describe it better:
I have a complicated header which is two lines long.
Row 3-8 contains values from the past months. These should be fixed, since sorting this would not make sense.
So far I have the past months (3-8) in <thead>.
Unfortunately, I have now found out that fixedHeader fixes the complete <thead> (1-8). I think I must now take the row 3-8 from <thead>, insert it in <tbody> and fix it so past months stay displayed in row 3-8 permanently.
My datatable is not working. Help?
@jive004 - I don't understand how your question relates to this thread. You already have an open thread for your question. Please post a link to a test case showing the issue there so we can offer you some help.
@bidon2 - Can you show me a screenshot of the table? I'm still not quite getting the layout I'm afraid.
Allan
Thanks for sending me screenshot by PM. To confirm, you want the blue header to be "fixed" but the 6 grey rows should not be fixed?
If you don't want rows to be fixed, you are correct, they would need to be in the
tbody
. If you want them to still be sorted to the top, you would need to use a plug-in such as that which is discussed here.Allan
It worked, thanks.
One last question (I hope ): Is there a way to hide the grey rows? I got the index "first six rows of tbody". search() and filter() seems to complicated for me and table.row(1).hide(); not working.
I want a button to toggle visibility of the rows.
bug
bug
Maybe you can post a link to your page or provide a test case showing what you have. This will make it easier for us to help with your questions.
Kevin
Like I said, I work in Intranet
To remove rows from a table body, you need to use the search capabilities of DataTables. Either
search()
or a search plug-in.Allan
Ok thanks.
Is there a way to not use regex rather than a css/jquery selector?
I need something like this:
var searchJQuery = $('tbody tr:not(.backgroundColorGreyLight)');
table.search(searchJQuery, false, false).draw();
For regex (which I don't know very good) I think I got no reference in the table. The only difference of the rows I want to hide (except different numbers which variate over the month) are the dates. And I don't want to implement a long date logic to the regex expression.
You can check the class names in a custom search plug-in since it will give you access to the
tr
node.It isn't possible to use a jQuery instance with
search()
.Allan