Link to a Specific Row In Table
-
Tobias,
Absolutely awesome plugin and having a ton of fun with it. I have two questions related to your responses and code provided at this other topic.
1.) All the link codes you provided in the above referenced topic work great with one exception. If the row you are pointing to is within the first set of entries shown as set in the main TablePress edit page >’Features of the DataTables Java Script libraries’ > Pagination, it will scroll down to the row. However, if it is not the link simply stops at the top of the table. Is there anything that can be done to solve this?
2.) Is there a way to have the link result in a search/filter so that when the page opens up only the row that is identified with with special code, as you described in the other topic, shows?
To see my table go to POWERandDATA.info
Thanks
-
Link to other topic (2nd try): other topic with referenced code
Here the link is typed out in case it doesn’t show again.
Hi,
sorry for the late answer on this one. It wasn’t tagged with “tablepress” properly, so that I didn’t see it in the list of TablePress questions here in the forums.
1.) I’m afraid that this is not possible. The reason for this is that is how the browser deals with these links. It will basically scroll down to the element that is referenced after the
#
character. However, when this element is not in the first set of visible rows, the browser can not see it, and therefore not scroll to it ?? Sorry.2.) This is not directly possible with the search/filter box above the table, but with a different filtering method: You could use the TablePress Extension from https://tablepress.org/extensions/row-filter/ and then also use https://tablepress.org/extensions/shortcode-filter-get-parameter/
That would allow you to get something similar with a filtering mechanism.Regards,
Tobias1. No problem. If I can get #2 to work it will be fantastic.
2. Was already using Row Filter plugin so loaded GET Parameter plugin and now have both installed as directed. However I think I need a little help with getting the link right. Your shows this example `https://www.example.com/?table_filter=myfilterword, but I can’t get it to work. I don’t think I’m getting the question mark (?) part right. I kept the existing code(<a href=”https://tablepress.org/extensions/row-filter/ “>), which works, and inserted “table_filter=” as follows:
<a href=”https://poweranddata.info/knowledge-center/terminology/#link-table-1table_filter=power-and-data”>
It takes you to the page, but doesn’t do the filter part. You can test it by clicking on the following link <a href=”https://poweranddata.info/about/knowledge-center/”> and then clicking on the term “power and data” in the first paragraph. If I understand the GET Parameter plugin correctly the table_filter is suposed to take you to the page at this link <a href=”https://poweranddata.info/knowledge-center/terminology/#link-table-1-power-and-data”> and filter the Term “power and data”.
NOTES:
1. In conjuction with your Column Filter plugin I’ve added “datatables_columnfilter=”true” to the table shortcode on the applicable page.2. In Custom Commands I have the following code so that the search/filter box filters only the ‘Term’ column, which works great:
`”aoColumnDefs”: [ { “bSearchable”: false, “aTargets”: [ 1 ] } ]
Your thoughts? Thanks
Hi,
the order of the parameters in the link is important here. The parameter after the
?
has to come first, and then the parameter with the#
:https://poweranddata.info/knowledge-center/terminology/?table-filter=power-and-data#link-table-1
Also, keep in mind that this filter would only be searching for the exact term “power-and-data”, so make sure that you have that in the table (if that’s the search term that you want). Also, make sure that you have changed the table Shortcode, as explained on https://tablepress.org/extensions/shortcode-filter-get-parameter/
Regards,
TobiasOk not working yet, but I think we’re getting close. For clarification here’s what I have so far:
1. As you reminded me above I added “-filter” to the shortcode located on the page where the table goes. It now looks like this:
[table-filter id=1 datatables_columnfilter=true /]
Also ref. item “b” below.2. On the page where the link goes I changed the link to exactly as you show it above. It now looks like this:
<a href="https://poweranddata.info/knowledge-center/terminology/?table-filter=power-and-data#link-table-1">power and data</a>
3. I verified that the exact term is in the search/filter column as you show above, except without hiphens. It looks like this:
power and data <span id="link-table-1-power-and-data"/>
Regarding the ‘span’, ref. item “e” below.<p style=”text-decoration:underline;font-weight:bold;”>POSSIBLE PROBLEM</p>
After adding the “-filter” to the shortcode on the page where the table goes the table didn’t showup as usual when viewed as a webpage. Instead just the shortcode showed. Could this be because the plugin didn’t add “-filter” to the actual TablePress shortcode as seen near the top of the TablePress edit page.<p style=”text-decoration:underline; font-style:italic;”>Additional Table Configuration References</p>
NOTE: I’m including these as a way to keep my head on straight and in case you might see a conflict.a.) COLUMN FILTERS (Bottom). The <p> Column Filter plugin</p> that provides search/filter boxes at the bottom of each column is install and activated, and “datatables_columnfilter=true” is still added to the shortcode located on the page where the table goes.
b.) ROW FILTERING. The <p> Row Filtering plugin</p> is installed and activated for use in conjuction with the Get Parameter Ext (see item “c” below). It proved not to be useful by itself because when a designated term is added to shortcode on page only that row shows on webpage table and cannot be undone from webpage using the search/filter box (only from page in WordPress)
c.) GET PARAMETER EXT. The <p> GET Parameter Extention</p> is installed and activated.
d.) SEARCH SINGLE COLUMN. Per the <p> Search a Single Column thread</p>, in the Custom Commands box under Features of the Java Script Library in the Edit page I still have the following code so that the search/filter box only filters the 1st column, which I titled “Term” and is where I list the terms to be searched. It works great and looks like this:
`”aoColumnDefs”: [ { “bSearchable”: false, “aTargets”: [ 1 ] } ]e.) LINK TO ROW. The ‘span’ is included after the term in the 1st column as designated by item “d” above to enable the ‘link to row’ feature you indicated in this <p> Forum thread</p>.
f.) COLUMN FILTER WIDGETS. The <p> ColumnFilterWidgets</p> plugin is installed, activated, but not working. Will ask about this in a different post.
As usual, thanks a ton for your help.
Hi,
thanks for the detailed explanation!
3. I verified that the exact term is in the search/filter column as you show above, except without hiphens. It looks like this: power and data <span id=”link-table-1-power-and-data”/> Regarding the ‘span’, ref. item “e” below.
The missing hyphens are the problem here. The search string “power-and-data” will not find “power and data”. Also, the “-power-and-data” is too much here. Therefore, please change the cell content to
power and data <span id="link-table-1"/>
and the link to
<a href="https://poweranddata.info/knowledge-center/terminology/?table-filter=power+and+data#link-table-1">power and data</a>
(Note the “+” which resemble spaces here.)
c.) GET PARAMETER EXT. The <p> GET Parameter Extention</p> is installed and activated.
Please verify this again, as that would be the reason why the
[table-filter /]
Shortcodes shows up as a Shortcode instead of a table.Additionally, a change is necessary in the source code of the Extension. Please open the file “tablepress-shortcode-filter-get-parameter.php” and replace the line
$filter_term = preg_replace( '#[^a-z0-9]#i', '', $filter_term ); // only allow characters a-z, A-Z, and 0-9 in filter term
with
$filter_term = preg_replace( '#[^a-z0-9 ]#i', '', $filter_term ); // only allow characters a-z, A-Z, 0-9, and the space in filter term
Regards,
TobiasTobias,
I greatly appriciate you sticking with me on this. Shortcode is still coming up instead of table. Here the status:Note: For for your convinience I temporarily added a page to my site so you can see snips of the changes I made as indicated below.
1. In the TablePress Table Edit page I changed the cell content in the column to be searched as indicated. Click link below to see snip.
2. Changed the link on the webpage as you indicated (including plus signs). Click link below to see snip.
3. Deleted and then reinstalled GET Parameter plugin to verify installation.
4. Changed GET Parameter PHP code as directed. Click link below to see snip.
Click here to see snips of changed code. For easier viewing, when you get there, click on green links to see blowups of snips.
Click here to test link. When you get to page click on the green “power and data”. It will take you to the page the table should be on. You’ll see the shortcode instead.
I hope I did things correctly. Thanks
Hi,
somehow the links didn’t make it into your post.
Also, if possible, I’d like to take a direct look at this on your site. That should be quicker than us having to post back and forth.
Could you therefore please send me an email with the credentials to a temporary admin account? (My address is in the main plugin file “tablepress.php”.) Thanks!Regards,
Tobias
- The topic ‘Link to a Specific Row In Table’ is closed to new replies.