The “search” and “filter” fields apply to filtering the results returned by the database when the page is loaded. Once you have those results on the page (or all results if you don’t use them) then the only way to filter them in the page itself is to use [cfdb-datatable] which gives you the search box (Example page). That search box comes from the external DataTables javascript library and so only appears for that shortcode.
The “search” field is intended to filter on the server side in the same way that the datatable search box works in the page. Really, its just a simpler form of “filter”.
The “yes” example is misleading, I will change that.
Thinking about what you want to achieve: conceivably you could open a table tag (give it an id), put in [cfdb-html] inside it where each entry is one table row with one table cell containing your formatted contents, then add the datatable script to wrap your table as a DataTable. That would then give you the search box.
To make your table a datatable, add this (wrap in a script tag)
jQuery(document).ready(function() {
jQuery('#YOUR_TABLE_ID').dataTable({
"bJQueryUI": true, "aaSorting": [] })
});
I wonder if I should create a shortcode for this….
Thread Starter
Andy
(@routetoweb)
Thanks for your reply.
I sort of archived what I was after and getting the url from the database to become a link with the following:
jQuery(window).load(function(){
jQuery("td").each(function(i){
if(jQuery(this).attr("title")=="Website"){
var strTD = jQuery("td").eq(i).text();
var strReplacingTD = '<a href="http:\/\/'+strTD+'">'+strTD+'</a>';
jQuery("td").eq(i).replaceWith("<td><div>"+strReplacingTD+"</div></td>");
};
});
});
Note “Website” is the name of the ‘data field’.
I’m not getting the page formatting that I would like to have achieved by using HTML, but the URLs from the database are now links and the data remains searchable both of which are of a higher priority.
I hope the code is of use to others.