Last modified by Drunk Monkey on 2023-04-26 18:21

From version 3.1
edited by Drunk Monkey
on 2021-03-22 04:09
Change comment: Install extension [clemensrobbenhaar:make-all-wiki-tables-sortable-macro/0.2]
To version 4.1
edited by Drunk Monkey
on 2022-02-14 06:02
Change comment: Install extension [clemensrobbenhaar:make-all-wiki-tables-sortable-macro/0.3]

Summary

Details

XWiki.JavaScriptExtension[0]
Code
... ... @@ -10,6 +10,11 @@
10 10   }
11 11   }
12 12  
13 + var findSortHeadRow = function(table) {
14 + var thCell = table.descendants();
15 + thCell[0].children.item(0).addClassName('sortHeader');
16 + }
17 +
13 13   $$("#xwikicontent table").each(function(table) {
14 14   if (table.getAttribute('class') !== null && table.getAttribute('class').indexOf('xwiki-livetable') >= 0) {
15 15   // ignore livetables; they take care of themselves
... ... @@ -24,6 +24,7 @@
24 24   table.setAttribute('id', tableIdPrefix + tableCounter);
25 25   }
26 26   findSortHeader(table);
32 + findSortHeadRow(table);
27 27   // we do not need to call this, as we are (hopefully) before window.load
28 28   //ts_makeSortable(table);
29 29   }
... ... @@ -35,6 +35,7 @@
35 35   table.setAttribute('id', tableIdPrefix + tableCounter);
36 36   }
37 37   findSortHeader(table);
44 + findSortHeadRow(table);
38 38   }
39 39   }
40 40   })
XWiki.WikiMacroClass[0]
Cached
... ... @@ -1,0 +1,1 @@
1 +No
Asynchronous rendering
... ... @@ -1,0 +1,1 @@
1 +No
Macro code
... ... @@ -2,6 +2,9 @@
2 2  $xwiki.ssfx.use("js/xwiki/table/table.css")
3 3  $xwiki.jsfx.use("js/xwiki/table/tablefilterNsort.js", true)
4 4  $xwiki.jsx.use("Macros.SortableTables", {'minify': true, "defer": false})
5 +#if($xcontext.macro.params.sticky=="yes")
6 + $xwiki.ssx.use("Macros.SortableTables")
7 +#end
5 5  {{/velocity}}{{velocity}}{{html clean="false"}}
6 6  <script type="text/javascript">
7 7  var macro_sortabletables_sortable = #if($xcontext.macro.params.sortable=="yes")true#{else}false#{end};
XWiki.StyleSheetExtension[0]
Caching policy
... ... @@ -1,0 +1,1 @@
1 +long
Code
... ... @@ -1,0 +1,8 @@
1 +#xwikicontent{
2 + overflow: unset;
3 +}
4 +.sortHeader{
5 + position: -webkit-sticky;
6 + position: sticky;
7 + top:0;
8 +}
XWiki.WikiMacroParameterClass[2]
Parameter default value
... ... @@ -1,0 +1,1 @@
1 +no
Parameter description
... ... @@ -1,0 +1,1 @@
1 +set to "yes", if the tables header should stick to the top of the screen when scrolling on a long table
Parameter mandatory
... ... @@ -1,0 +1,1 @@
1 +No
Parameter name
... ... @@ -1,0 +1,1 @@
1 +sticky