Hey Simon,
Unfortunately, this feature is not part of the plugin, however I will add this to the feature request list. In the meantime, if you are comfortable with editing js files, you can add the following code to the jtrt-responsive-tables-public.js file on line 125:
if(getParameterByName('jtrt_dt_search') != undefined){ jtrtDTcopy.search(getParameterByName('jtrt_dt_search')).draw();}
then you need to create a function called getParameterByName which was taken from of StackOverflow 😀
function getParameterByName(name, url) {
if (!url) {
url = window.location.href;
}
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
I’ve created a simple gist with the changes, so if you want just copy paste the contents of the following gist into the jtrt-responsive-tables-public.js file and save changes.
https://gist.github.com/JohnTendik/9dc579512a20a86b830779ed477efd4c
now you can filter your table on load when you have the following url parameter:
http://mywebsite.com/jttablepage/?jtrt_dt_search=volvo
Hope this helps.
Thanks for using my plugin and offering suggestions 😀 I’m always looking for ways to improve. Let me know if there is anything else I can help you with.
John
-
This reply was modified 9 years, 2 months ago by
MyThirdEye.
My reply disappeared for some reason, here is a copy paste hopefully this works. WP forums wont let me add the comment.
Hey Simon,
Unfortunately, this feature is not part of the plugin, however I will add this to the feature request list. In the meantime, if you are comfortable with editing js files, you can add the following code to the jtrt-responsive-tables-public.js file on line 125:
if(getParameterByName('jtrt_dt_search') != undefined){ jtrtDTcopy.search(getParameterByName('jtrt_dt_search')).draw();}
then you need to create a function called getParameterByName which was taken from of StackOverflow 😀
function getParameterByName(name, url) {
if (!url) {
url = window.location.href;
}
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
I’ve created a simple gist with the changes, so if you want just copy paste the contents of the following gist into the jtrt-responsive-tables-public.js file and save changes.
https://gist.github.com/JohnTendik/9dc579512a20a86b830779ed477efd4c
now you can filter your table on load when you have the following url parameter:
http://mywebsite.com/jttablepage/?jtrt_dt_search=volvo
Hope this helps.
Thanks for using my plugin and offering suggestions 😀 I’m always looking for ways to improve. Let me know if there is anything else I can help you with.
John
Hi John,
That’s amazing I’m going to try this tomorrow and will let you know!
If it works it’s going to make sharing data in the table so easy.
Thanks again,
Simon
No problem 😛 Glad I could help!
Hi John,
Unfortunately, having saved over the original JS file with the GIS code you provided, it doesn’t seem to filer by the URL.
Try:
http://www.simonlyplans.com/sim-only-deals/?jtrt_dt_search=o2
You’ll see it doesn’t filter the table by “o2”.
Thanks,
Simon
Something really weird with Support Forums at the moment.
It says you have replied since my last comment, but no reply is shown here!
Hey @fabbstar,
I had done that example using datatables, so using responsive options “scroller” or “stack”, using the hiding columns option will use a different table script which is footables. I will look into whether or not this is possible and get back to you.
Thanks
John
Hey @fabbstar,
Can you try the new gist, it will include footable filter with the url as well.
Hope this helps 😀
https://gist.github.com/JohnTendik/9dc579512a20a86b830779ed477efd4c
John
YOU DID IT!!! AMAZING.
Thanks John.
Make it a default feature, great thing!
Simon
No problem, glad I could help! 🙂 I’ll include this feature in the update.