Filtering rows of a table?
-
Hi,
is it possible to filter rows from a table?
Example: I want to show the row 3, 4, 7, 15 and 36 from a table.
Can i do this by adding a command to the short code?
Regards
Hartwig
-
There is a further question….
Is it possible that the search field at the top of the table only searches in column 2?
Regards
HartwigAnd another further question….
If I use the extension row filtering i get a table where the distance between the text-rows in a cell is much bigger than in the normal table. What can i do against that?
Regards
HartwigHellow Hartwig,
thanks for your post, and sorry for the trouble.
Showing just some certain rows is possible with the
hide_rowsandshow_rowsShortcode parameters, for example[table id=123 hide_rows="all" show_rows="3,4,7,15,36" /]Making the Search above the table only search column 2 is possible by excluding all other columns. For that, please try adding this into the “Custom Commands” textfield on the “Edit” screen of the table:
"aoColumnDefs": [ { "bSearchable": false, "aTargets": [ 0, 2, 3, 4, 5 ] } ]You’ll need to add all column numbers to that code, except “1”, as that means the second column (counting starts with 0 in the code).
The Row Filter Extension doesn’t change how the table is styled or how the padding is set up. I’m therefore confused that this happens. Can you please post a link to the page with the table where this problem happens, so that I can take a direct look? Thanks!
Regards,
TobiasThank you for your fast response!
1. works 🙂
Is it possible to write show_rows=”3 to 8″ instead of “3,4,5,6,7,8”?
2. works 🙂
3. I sent you an email with the link and the Password.
Regards
HartwigHello Hartwig,
1. Sure, just write them as
show_rows="3-8"3. Thanks! It like there are some HTML tags around the Shortcode. Please check this in the “Text” editor (not the “Visual” editor). You should see HTML
<pre>and</pre>tags around the Shortcode which need to be removed.Regards,
TobiasGreat!!!!
Thank you very much….. i would have never found that!
You are really great!
Regards,
HartwigHi,
no problem, you are very welcome! 🙂 Good to hear that this helped!
Best wishes,
TobiasP.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!
Hi again 🙂
"aoColumnDefs": [ { "bSearchable": false, "aTargets": [ 0, 2 ] } ]okay this works very fine…… but is it possible to restrict that only for the search in the search field, but not for the search with shortcode? With a command in the shortcode?
Regards,
HartwigHello Hartwig,
I’m confused as to what you mean here.
That code will only affect the search field right above the table. It does not influence the filtering via the “filter” Shortcode parameter.Regards,
TobiasThank you for your fast reply
Ahhh…. yes, you are right, it’s my mistake.
I thought i could filter for a string like “HS 35”, but it doesn’t works with white space. Also the filter looks not for the complete word/string (but thats what i need)My code was
[table id=1 filter=""HS 35"&&"HS 40"" /]Is it possible to filter for a string? With white space?
Perhaps another way…… I put not visible code in a cell of the row and filter for it?
Regards,
HartwigHi,
white space in the Shortcode is no problem, actually.
In your example, you’d have to write[table id=1 filter="HS 35&&HS 40" /]Regards,
TobiasHi Tobias,
YES, it works….
Now I understand my mistake….. i don’t have to write && but || 😉
Thank you very much for your fast help! Thats really great!
Best Regards,
HartwigHi,
ah, yes
&&would look for both keywords in the same row…
Nice find 🙂Best wishes,
TobiasP.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!
Hi, me again,
I have an idea and hope, that you have a solution to realize it 🙂
At the moment i have no content in the first row, so it is not shown…
What I want:
I want to write a text in the first row, but it is not shown in the table. Then, if someone clicks in the search field, the text should be shown. So I can write in the first row a little help how to use the search field and which keywords are available. It would be only shown, if needed.
Is this possible? May be there is a better solution for that?
Is it possible to connect the cells from the first row?Regards,
HartwigHi,
you could use some JavaScript code to show that content once someone clicks into the search field. Unfortunately, I don’t have that code ready, but with some jQuery it should not be that hard.
Then, connecting cells is possible, but the problem is that the DataTables JS library does not work in such tables — thus, this approach won’t work.
The better solution probably is to just write a small explanation above the table Shortcode. It would be visible at all times, but that should help users to actually recognize the search field.
Regards,
Tobias
The topic ‘Filtering rows of a table?’ is closed to new replies.