Priority: Normal
Current State: No Action Required
Released In: n/a
Target Release:
I like using the HTML5 data attributes option for configuring
JQDataTablesPlugin so that I can explicitly define the table format within the
SEARCH or DBQUERY macro. However, several of the parameters outlined for DataTables do not appear to work in this mode.
Looking at the examples in the docs and the perl module (
DataTables.pm), it appears that several things are going on:
- Mis-match in attribute names: In the parameters list, it refers to "paging" or "pager". In the HTML5 examples, it uses "paginate".
- Mis-match between attribute names and code: In the parameters list, it refers to "pagelength" and "lengthmenu". However, in the perl code, it appears to expect these attributes to be referred to as "page-length" and "length-menu". Changing the html4 data attributes to use these names seem to work. There are several other parameters that appear to have this naming mis-match between the parameter list and the expected html5 data names. Not sure if this is a code error or a needed change to the documentation.
- Feature doesn't work in html5: The attribute "searchmode" appears to be referenced in the perl code as "search-mode" in the html5 section, but it doesn't work using either "data-searchmode='multi'" or "data-search-mode='multi'".
--
LynnwoodBrown - 05 Oct 2016
The Foswiki
%DATATABLE
macro does not directly translate to
DataTables
html5 data attributes. Instead it uses them.
The documentation for the
%DATATABLE
Foswiki macro should be consistent:
-
paging
and pager
are synonyms
-
pagelentgh
and lengthmenu
are two different things
-
searchmode
triggers a complete set of more complicated configuration parameters of the jQuery library underneath
See
Extensions.JQDataTablesPlugin#DATATABLE
In case you'd like to initialize a data table via javascript, please do use the
original reference manual.
I don't see a bug here.
--
MichaelDaum - 06 Oct 2016
I'm not sure I fully understand your response. I understand your first statement to mean that not all the parameters listed for the DATATABLE macro can be applied to the HTML5 format. Fair enough there but might be worth mentioning that in the docs. What do you mean by "Instead it uses them"?
Perhaps the docs could list the parameters that are allowed as HTML5 attributes. I mentioned dat-page-length and data-length-menu which I gathered from the perl code and confirmed they worked in practice, but these are
not listed in the documentation. Perhaps no bug but rather suggestions minor enhancements to the doc in next release.
--
LynnwoodBrown - 06 Oct 2016
The docs by far won't cover all of the original reference manual I gave you the pointer to in my above reply.
"Instead it uses them" means: it uses a set of options to implement the desired feature. This is more complex than a single HTML5 parameter, i.e. to implement the two different search modes available as a single option to the
%DATATABLE
macro.
--
MichaelDaum - 06 Oct 2016