X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Fhazelnut%2Fstatic%2Fjs%2Fhazelnut.js;h=89275eee06d6775ddfc638141a7a5d4ea7da4835;hb=4ff1372de7efe594e67562ab6c28df4b9f1a3b39;hp=12ee398db0a61962f97a1657b5b729552aaa4bc3;hpb=77b2405d408ac7bcd80e3d618bbc44ef13fef069;p=myslice.git diff --git a/plugins/hazelnut/static/js/hazelnut.js b/plugins/hazelnut/static/js/hazelnut.js index 12ee398d..89275eee 100644 --- a/plugins/hazelnut/static/js/hazelnut.js +++ b/plugins/hazelnut/static/js/hazelnut.js @@ -98,7 +98,10 @@ // XXX use $.proxy here ! }; // the intention here is that options.datatables_options as coming from the python object take precedence - // XXX DISABLED by jordan: was causing errors in datatables.js $.extend(actual_options, options.datatables_options ); + // xxx DISABLED by jordan: was causing errors in datatables.js + // xxx turned back on by Thierry - this is the code that takes python-provided options into account + // check your datatables_options tag instead + $.extend(actual_options, this.options.datatables_options ); this.table = this.elmt('table').dataTable(actual_options); /* Setup the SelectAll button in the dataTable header */ @@ -504,4 +507,16 @@ $.plugin('Hazelnut', Hazelnut); + /* define the 'dom-checkbox' type for sorting in datatables + http://datatables.net/examples/plug-ins/dom_sort.html + using trial and error I found that the actual column number + was in fact given as a third argument, and not second + as the various online resources had it - go figure */ + $.fn.dataTableExt.afnSortData['dom-checkbox'] = function ( oSettings, _, iColumn ) { + return $.map( oSettings.oApi._fnGetTrNodes(oSettings), function (tr, i) { + return result=$('td:eq('+iColumn+') input', tr).prop('checked') ? '1' : '0'; + } ); + } + })(jQuery); +