{"id":91,"date":"2011-02-17T16:01:57","date_gmt":"2011-02-17T21:01:57","guid":{"rendered":"http:\/\/cfdbplugin.com\/?page_id=91"},"modified":"2016-12-15T21:56:12","modified_gmt":"2016-12-16T02:56:12","slug":"cfdb-datatable","status":"publish","type":"page","link":"https:\/\/cfdbplugin.com\/?page_id=91","title":{"rendered":"[cfdb-datatable]"},"content":{"rendered":"<p><span style=\"font-weight:bold; background-color:#FFFF99;\">This documentation applies to version 2.6 and later<\/span><\/p>\n<h1><strong>Summary of Shortcode Options<\/strong><\/h1>\n<table width=\"100%\" border=\"1\" cellspacing=\"1\" cellpadding=\"1\" align=\"left\">\n<tbody>\n<tr>\n<td valign=\"middle\" width=\"10%\"><strong>Option<\/strong><\/td>\n<td width=\"40\"><strong>Example<br \/>\n<\/strong><\/td>\n<td width=\"40%\"><strong>Description<\/strong><\/td>\n<\/tr>\n<tr>\n<td valign=\"middle\" width=\"10%\"><a href=\"http:\/\/cfdbplugin.com\/?page_id=89#form\"><strong>form<\/strong><\/a><\/td>\n<td width=\"40\"><code>[cfdb-datatable <strong>form=\"myform\"<\/strong>]<\/code><\/td>\n<td width=\"40%\">Required. Designates the form to display. All rows and columns are displayed by default<\/td>\n<\/tr>\n<tr>\n<td valign=\"middle\" width=\"10%\"><a href=\"http:\/\/cfdbplugin.com\/?page_id=89#role\"><strong>role<\/strong><\/a><\/td>\n<td width=\"40\"><code>[cfdb-datatable form=\"myform\" <strong>role=\"Author\"<\/strong>]<\/code><\/td>\n<td width=\"40%\">Make short code only display output for user&#8217;s with minimum-required role. Choices are<\/p>\n<ul>\n<li>Administrator<\/li>\n<li>Editor<\/li>\n<li>Author<\/li>\n<li>Contributor<\/li>\n<li>Subscriber<\/li>\n<li>Anyone<\/li>\n<\/ul>\n<p><strong>WARNING<\/strong>: this setting is overridden by plugin setting in WP Admin page Contact -&gt; Database Options -&gt; Can See Submission when using shortcodes<br \/>\n(since 2.4.1)<\/td>\n<\/tr>\n<tr>\n<td valign=\"middle\" width=\"10%\"><a href=\"http:\/\/cfdbplugin.com\/?page_id=89#show\"><strong>show<\/strong><\/a><\/td>\n<td width=\"40\"><code>[cfdb-datatable form=\"myform\" <strong>show=\"col1,col2\"<\/strong>]<\/code><\/td>\n<td width=\"40%\">Limits columns to be shown to be those designated (comma-delimited list)<\/td>\n<\/tr>\n<tr>\n<td valign=\"middle\" width=\"10%\"><a href=\"http:\/\/cfdbplugin.com\/?page_id=89#hide\"><strong>hide<\/strong><\/a><\/td>\n<td width=\"40\"><code>[cfdb-datatable form=\"myform\" <span style=\"font-weight: bold;\">hide<\/span><strong>=\"col1,col2\"<\/strong>]<\/code><\/td>\n<td width=\"40%\">Does not show listed columns (comma-delimited list)<\/td>\n<\/tr>\n<tr>\n<td valign=\"middle\" width=\"10%\"><strong>header<\/strong><\/td>\n<td align=\"left\" valign=\"middle\" width=\"40%\"><code>[cfdb-table form=\"myform\" <span style=\"font-weight: bold;\">header<\/span><strong>=\"false\"<\/strong>]<\/code><\/td>\n<td width=\"40%\">Show or do not show the table header. Valid values are <strong>true<\/strong> (the default) and <strong>false<\/strong><\/td>\n<\/tr>\n<tr>\n<td valign=\"middle\" width=\"10%\"><a name=\"headers\"><\/a><strong>headers<\/strong><\/td>\n<td align=\"left\" valign=\"middle\" width=\"40%\"><code>[cfdb-table form=\"myform\" <span style=\"font-weight: bold;\">headers<\/span><strong>=\"your-name=Name,ex_field1=Email\"<\/strong>]<\/code><\/td>\n<td width=\"40%\">Allows you to change the name displayed in the table header. Map a form field names to a more readable display names. (Since 2.5.1)<\/td>\n<\/tr>\n<tr>\n<td valign=\"middle\" width=\"10%\"><a href=\"http:\/\/cfdbplugin.com\/?page_id=89#limit\"><strong>limit<\/strong><\/a><\/td>\n<td align=\"left\" valign=\"middle\" width=\"40%\"><code>[cfdb-datatable\u00a0form=\"myform\"\u00a0<strong>limit=\"10\"<\/strong>]<\/code><\/td>\n<td width=\"40%\">One number: limit=&#8221;10&#8243; means show first 10 rows. Is the same as limit=&#8221;0,10&#8243;<br \/>\nTwo Numbers: limit=&#8221;100,10&#8243; means show 10 rows starting at row #100)<\/td>\n<\/tr>\n<tr>\n<td valign=\"middle\" width=\"10%\"><a href=\"http:\/\/cfdbplugin.com\/?page_id=89#random\"><strong>random<\/strong><\/a><\/td>\n<td align=\"left\" valign=\"middle\" width=\"40%\"><code>[cfdb-table form=\"myform\"\u00a0<strong>random=\"2\"<\/strong>]<\/code><\/td>\n<td width=\"40%\">Display 2 random rows from those that the short code finds. (Since 2.4)<\/td>\n<\/tr>\n<tr>\n<td valign=\"middle\" width=\"10%\"><a href=\"http:\/\/cfdbplugin.com\/?page_id=89#orderby\"><strong>orderby<\/strong><\/a><\/td>\n<td align=\"left\" valign=\"middle\" width=\"40%\"><code>[cfdb-datatable\u00a0form=\"myform\"\u00a0<strong>orderby=\"last-name,first-name\"<\/strong>]<\/code><\/td>\n<td width=\"40%\">Sort rows by designated columns. Use &#8220;column-name desc&#8221; to sort in descending (reverse) order<\/td>\n<\/tr>\n<tr>\n<td valign=\"middle\" width=\"10%\"><a href=\"http:\/\/cfdbplugin.com\/?page_id=89#search\"><strong>search<\/strong><\/a><\/td>\n<td width=\"40\"><code>[cfdb-datatable\u00a0form=\"myform\"\u00a0<span style=\"font-weight: bold;\">search<\/span><strong>=\"Simpson\"<\/strong>]<\/code><\/td>\n<td width=\"40%\">Select rows to display that have any cell with the search text in it (case insensitive). Intended to mimic behavior of the &#8220;Search&#8221; field in the DataTable<\/td>\n<\/tr>\n<tr>\n<td valign=\"middle\" width=\"10%\"><a href=\"http:\/\/cfdbplugin.com\/?page_id=89#filter\"><strong>filter<\/strong><\/a><\/td>\n<td width=\"40\"><code>[cfdb-datatable form=\"myform\" <span style=\"font-weight: bold;\">filter<\/span><strong>=\"col1=Simpson\"<\/strong>]<\/code><\/td>\n<td width=\"40%\">Select which rows to display based on filter expression. More powerful than &#8220;search&#8221;, it can filter on multiple columns with boolean and regular expressions. If both &#8220;search&#8221; and &#8220;filter&#8221; are specified, &#8220;search&#8221; is ignored.<\/td>\n<\/tr>\n<tr>\n<td colspan=\"3\" valign=\"middle\" width=\"10%\"><em>Options specific to this shortcode<\/em><\/td>\n<\/tr>\n<tr>\n<td valign=\"middle\" width=\"10%\"><a id=\"edit\"><\/a><strong>edit<\/strong><\/td>\n<td width=\"40\"><code>[cfdb-datatable\u00a0form=\"myform\" <strong>edit=\"true\"<\/strong>]<\/code><br \/><code>[cfdb-datatable\u00a0form=\"myform\" <strong>edit=\"cells\"<\/strong>]<\/code><\/td>\n<td width=\"40%\">Enables editing mode to edit the cells and column names in the table (true) or just cells (cells). <strong><span style=\"text-decoration: underline;\">Only works if <a href=\"http:\/\/cfdbplugin.com\/?page_id=459\">Editor plugin extension<\/a> is installed<\/span><\/strong>. Editing will not work unless the user is logged in and his role allows for editing (see <strong>Options page<\/strong>, <strong>Can Edit\/Delete Submission data<\/strong> setting. (since Version 2.6)<strong>Warning<\/strong>: table column headers can also be edited, but will not work properly if you are using &#8220;<strong>headers<\/strong>&#8221; in this short code to rename them.<\/td>\n<\/tr>\n<tr>\n<td valign=\"middle\" width=\"10%\"><a id=\"editcolumns\"><\/a><strong>editcolumns<\/strong><\/td>\n<td width=\"40\"><code>[cfdb-datatable\u00a0form=\"myform\" <strong>edit=\"cells\" editcolumns=\"column3,column5\"<\/strong>]<\/code><\/td>\n<td width=\"40%\">Specify the columns to make editable. When omitted, all columns are editable.<strong><span style=\"text-decoration: underline;\"><br \/>Only works if <a href=\"http:\/\/cfdbplugin.com\/?page_id=459\">Editor plugin extension<\/a> is installed<\/span><\/strong>.<\/td>\n<\/tr>\n<tr>\n<td valign=\"middle\" width=\"10%\"><a href=\"#dt_options\"><strong>dt_options<\/strong><\/a><\/td>\n<td width=\"40\"><code>[cfdb-datatable\u00a0form=\"myform\" <strong>dt_options=\"bJQueryUI:true, sScrollX:'100%', bScrollCollapse:true\"<\/strong>]<\/code><\/td>\n<td width=\"40%\">Allows you to specify <a href=\"http:\/\/datatables.net\/ref\" target=\"_blank\">DataTable Javascript configuration features<\/a><\/td>\n<\/tr>\n<tr>\n<td valign=\"middle\" width=\"10%\"><strong>id<\/strong><\/td>\n<td width=\"40\"><code>[cfdb-datatable\u00a0form=\"myform\" <span style=\"font-weight: bold;\">id<\/span><strong>=\"myid\"<\/strong>]<\/code><\/td>\n<td width=\"40%\">Sets the <strong>id <\/strong>attribute on the <strong>table <\/strong>tag.<br \/>\nSame as for <a href=\"http:\/\/cfdbplugin.com\/?page_id=93\">[cfdb-table]<\/a><\/td>\n<\/tr>\n<tr>\n<td valign=\"middle\" width=\"10%\"><strong>class<\/strong><\/td>\n<td width=\"40\"><code>[cfdb-datatable\u00a0form=\"myform\" <span style=\"font-weight: bold;\">class<\/span><strong>=\"myclass\"<\/strong>]<\/code><\/td>\n<td width=\"40%\">Sets the <strong>class <\/strong>attribute on the <strong>table <\/strong>tag.<br \/>\nSame as for <a href=\"http:\/\/cfdbplugin.com\/?page_id=93\">[cfdb-table]<\/a><br \/>\n* <strong>GENERALLY NOT\u00a0USED <\/strong>because DataTables add its styles.<\/td>\n<\/tr>\n<tr>\n<td valign=\"middle\" width=\"10%\"><strong>style<\/strong><\/td>\n<td width=\"40\"><code>[cfdb-datatable\u00a0form=\"myform\" id=\"myid\" <span style=\"font-weight: bold;\">style<\/span><strong>=\"#myid th &gt; td { font-size: x-small; background-color: #E8E8E8;\u00a0 }\"<\/strong>]<\/code><\/td>\n<td width=\"40%\">Injects input CSS into a style tag.<br \/>\nSame as for <a href=\"http:\/\/cfdbplugin.com\/?page_id=93\">[cfdb-table]<\/a><br \/>\n* <strong>GENERALLY NOT\u00a0USED <\/strong>because DataTables add its styles.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p style=\"margin: 0px 0px 22px; padding: 0px; clear: left; font-size: 13px;\">Use<code style=\"font-style: normal; font-weight: normal; font-family: Consolas,Monaco,'Courier New',Courier,monospace; color: #000000; background-color: #ededff;\">[cfdb-datatable form=\"your-form\"]<\/code>. This shortcode provides a dynamically filterable and sortable table on your page. This is different than the<code style=\"font-style: normal; font-weight: normal; font-family: Consolas,Monaco,'Courier New',Courier,monospace; color: #000000; background-color: #ededff;\">filter<\/code> parameter on the shortcode. The<code style=\"font-style: normal; font-weight: normal; font-family: Consolas,Monaco,'Courier New',Courier,monospace; color: #000000; background-color: #ededff;\">filter<\/code>parameter (such as in<code style=\"font-style: normal; font-weight: normal; font-family: Consolas,Monaco,'Courier New',Courier,monospace; color: #000000; background-color: #ededff;\">[cfdb-datatable form=\"your-form\" filter=\"field1=value1\"]<\/code>creates a table with only the data selected by the filter. But once you have a table showing on a page, you can further dynamically filter using the &#8220;Search&#8221; field above the displayed Datatable.<\/p>\n<p style=\"margin: 0px 0px 22px; padding: 0px; clear: left; font-size: 13px;\">Notes:<\/p>\n<ul>\n<li>All options that apply to<code style=\"font-style: normal; font-weight: normal; font-family: Consolas,Monaco,'Courier New',Courier,monospace; color: #000000; background-color: #ededff;\">[cfdb-table]<\/code>also apply to<code style=\"font-style: normal; font-weight: normal; font-family: Consolas,Monaco,'Courier New',Courier,monospace; color: #000000; background-color: #ededff;\">[cfdb-datatable]<\/code>. Refer to the<a href=\"http:\/\/cfdbplugin.com\/?page_id=93\"><code style=\"font-style: normal; font-weight: normal; font-family: Consolas,Monaco,'Courier New',Courier,monospace; color: #000000; background-color: #ededff;\">[cfdb-table]<\/code><\/a> page.<\/li>\n<li><code style=\"font-style: normal; font-weight: normal; font-family: Consolas,Monaco,'Courier New',Courier,monospace; color: #000000; background-color: #ededff;\">[cfdb-datatable]<\/code>relies on<a style=\"text-decoration: none; color: #21759b; font-weight: normal; border-bottom: 1px solid #dfdfdf;\" title=\"DataTable\" href=\"http:\/\/www.datatables.net\/\">DataTable<\/a> Javascript.<\/li>\n<\/ul>\n<p>Essentially, this shortcode does the same thing as <code style=\"font-style: normal; font-weight: normal; font-family: Consolas,Monaco,'Courier New',Courier,monospace; color: #000000; background-color: #ededff;\">[cfdb-table]<\/code> in that it outputs an HTML table. But in addition to that, it adds in DataTable Javascript that takes that table and wraps it in DataTable styles and functionality.<\/p>\n<p><strong><a name=\"dt_options\"><\/a>DataTable Features<\/strong><\/p>\n<p>If you want to set <a style=\"text-decoration: none; color: #21759b; font-weight: normal; border-bottom: 1px solid #dfdfdf;\" title=\"DataTable Features\" href=\"http:\/\/www.datatables.net\/usage\/features\">DataTable Features<\/a>\u00a0on your table, then you can pass them using the\u00a0<code style=\"font-style: normal; font-weight: normal; font-family: Consolas,Monaco,'Courier New',Courier,monospace; color: #000000; background-color: #ededff;\">dt_option<\/code>\u00a0short code parameter. But realize, that your dt_options replace all the default ones<\/p>\n<p><strong>dt_options Examples:<\/strong><\/p>\n<p>Display 300 rows to start using &#8220;iDisplayLength&#8221;:<\/p>\n<p><code>[cfdb-datatable form=\"your-form\" id=\"mytable\" dt_options=\"bJQueryUI:true, iDisplayLength:300\"]<\/code><\/p>\n<p>Outputs the following. So be sure you are providing valid JavaScript syntax.<\/p>\n<pre>&lt;script type=\"text\/javascript\" language=\"Javascript\"&gt;\r\n   jQuery(document).ready(function() {\r\n      jQuery('#cftble_538218743').dataTable({\r\n         bJQueryUI:true, iDisplayLength:300 })\r\n   });\r\n&lt;\/script&gt;<\/pre>\n<p>&nbsp;<\/p>\n<p>Setting other display controls:<\/p>\n<p><code>[cfdb-datatable form=\"your-form\" id=\"mytable\" dt_options=\"bJQueryUI:true, sScrollX:'100%', bScrollCollapse:true\"]<\/code><\/p>\n<p>&nbsp;<\/p>\n<p><strong>FAQ: Why doesn&#8217;t my data table look like the one in the Admin Panel?<\/strong><br \/>\nBecause you need to include some additional style sheets which are not included by default because they could conflict with your theme&#8217;s styles. You might wish to add them to your theme&#8217;s style sheet.<\/p>\n<p><strong>(1) JQuery UI<\/strong> Gives it the solid bars across the top and bottom:<\/p>\n<p><strong>PHP:<\/strong> <code>wp_enqueue_style('jquery-ui.css', 'http:\/\/ajax.googleapis.com\/ajax\/libs\/jqueryui\/1.8.6\/themes\/base\/jquery-ui.css');<\/code><\/p>\n<p><strong>HTML:<\/strong> <code>&lt;link rel='stylesheet' id='jquery-ui.css-css'\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0href='http:\/\/ajax.googleapis.com\/ajax\/libs\/jqueryui\/1.8.6\/themes\/base\/jquery-ui.css?ver=3.1' type='text\/css'\u00a0\u00a0media='all'\/&gt;<\/code><\/p>\n<p><strong>(2) Some demo css from data tables<\/strong>. But it is written in such a way that is can style other tables on the page that you don&#8217;t want to be affected by this:<\/p>\n<p><strong>PHP:<\/strong> <code>wp_enqueue_style('datatables-demo', 'http:\/\/www.datatables.net\/release-datatables\/media\/css\/demo_table.css');<\/code><\/p>\n<p><strong>HTML:<\/strong> <code>&lt;link rel='stylesheet' id='datatables-demo-css'<br \/>\nhref='http:\/\/www.datatables.net\/release-datatables\/media\/css\/demo_table.css?ver=3.1'<br \/>\ntype='text\/css'<br \/>\nmedia='all'\/&gt;<\/code><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary of Shortcode Options Option Example Description form Required. Designates the form to display. All rows and columns are displayed by default role Make short code only display output for user&#8217;s with minimum-required role. Choices are Administrator Editor Author Contributor Subscriber Anyone WARNING: this setting is overridden by plugin setting in WP Admin page Contact [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1577,"menu_order":1,"comment_status":"closed","ping_status":"closed","template":"","meta":{"jetpack_post_was_ever_published":false,"footnotes":""},"class_list":["post-91","page","type-page","status-publish","hentry"],"jetpack_shortlink":"https:\/\/wp.me\/P1mptf-1t","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/pages\/91","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=91"}],"version-history":[{"count":35,"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/pages\/91\/revisions"}],"predecessor-version":[{"id":1466,"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/pages\/91\/revisions\/1466"}],"up":[{"embeddable":true,"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/pages\/1577"}],"wp:attachment":[{"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=91"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}