# HG changeset patch # User Aurelien Campeas # Date 1319211776 -7200 # Node ID 9a73d5e762b0b23b3393f4c1963ae078d4c9462c # Parent ea012d90825da0303ff412194a8ba4b2fec64ce6 [facets] fix context passing + a note for later diff -r ea012d90825d -r 9a73d5e762b0 web/data/cubicweb.js --- a/web/data/cubicweb.js Fri Oct 21 17:14:05 2011 +0200 +++ b/web/data/cubicweb.js Fri Oct 21 17:42:56 2011 +0200 @@ -85,7 +85,7 @@ sortValueExtraction: function (node) { var sortvalue = jQuery(node).attr('cubicweb:sortvalue'); - if (sortvalue === undefined) { + if (sortvalue === undefined) { return ''; } return sortvalue; diff -r ea012d90825d -r 9a73d5e762b0 web/data/jquery.tablesorter.js --- a/web/data/jquery.tablesorter.js Fri Oct 21 17:14:05 2011 +0200 +++ b/web/data/jquery.tablesorter.js Fri Oct 21 17:42:56 2011 +0200 @@ -684,7 +684,7 @@ function getCachedSortType(parsers, i) { return parsers[i].type; }; /* public methods */ - this.construct = function (settings) { + this.construct = function (settings) { cw.log(settings); return this.each(function () { // if no thead or tbody quit. if (!this.tHead || !this.tBodies) return; diff -r ea012d90825d -r 9a73d5e762b0 web/views/facets.py --- a/web/views/facets.py Fri Oct 21 17:14:05 2011 +0200 +++ b/web/views/facets.py Fri Oct 21 17:42:56 2011 +0200 @@ -160,6 +160,10 @@ :param hiddens: other hidden parametters to include in the forms. :type hiddens: dict from extra keyword argument """ + # XXX Facet.context property hijacks an otherwise well-behaved + # vocabulary with its own notions + # Hence we whack here to avoid a clash + kwargs.pop('context', None) baserql, wdgs = facets(self._cw, rset, context=self.__regid__, mainvar=mainvar, **kwargs) assert wdgs diff -r ea012d90825d -r 9a73d5e762b0 web/views/tableview.py --- a/web/views/tableview.py Fri Oct 21 17:14:05 2011 +0200 +++ b/web/views/tableview.py Fri Oct 21 17:42:56 2011 +0200 @@ -147,9 +147,9 @@ def _setup_tablesorter(self, divid): self._cw.add_css('cubicweb.tablesorter.css') self._cw.add_js('jquery.tablesorter.js') - self._cw.add_onload('''$(document).ready(function() { - $("#%s table").tablesorter(%s); -});''' % (divid, js_dumps(self.tablesorter_settings))) + print '$("#%s table").tablesorter(%s);' % (divid, js_dumps(self.tablesorter_settings)) + self._cw.add_onload('$("#%s table").tablesorter(%s);cw.log("done");' % + (divid, js_dumps(self.tablesorter_settings))) def __init__(self, req, view, **kwargs): super(TableLayout, self).__init__(req, **kwargs) @@ -177,6 +177,7 @@ self._cw.add_css(self.needs_css) if self.needs_js: self._cw.add_js(self.needs_js) + print self.enable_sorting if self.enable_sorting: self._setup_tablesorter(self.view.domid) # Notice facets form must be rendered **outside** the main div as it