[javascript][facets] facetargs wasn't evaluated in all cases 3.0
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Thu, 15 Jan 2009 15:58:13 +0100
branch3.0
changeset 434 915b4c6ffe5e
parent 432 8a7f619fce96
child 435 7c19ba5bfbbb
[javascript][facets] facetargs wasn't evaluated in all cases
web/data/cubicweb.formfilter.js
--- a/web/data/cubicweb.formfilter.js	Thu Jan 15 14:39:19 2009 +0100
+++ b/web/data/cubicweb.formfilter.js	Thu Jan 15 15:58:13 2009 +0100
@@ -109,10 +109,9 @@
     root = root || document;
     jQuery(root).find('form').each(function () {
 	var form = jQuery(this);
-	var facetargs = form.attr('cubicweb:facetargs');
-	if (facetargs) {
+	var facetargs = evalJSON(form.attr('cubicweb:facetargs'));
+	if (facetargs !== undefined && facetargs.length) {
 	    form.submit(function() {
-		var facetargs = evalJSON(form.attr('cubicweb:facetargs'));
 	        buildRQL.apply(null, facetargs); //(divid, vid, paginate, extraargs);
 	        return false;
 	    });
@@ -122,7 +121,6 @@
 		    this.setAttribute('cubicweb:idx', i);
 		});
 		facet.find('div.facetCheckBox').click(function () {
-		    var facetargs = evalJSON(form.attr('cubicweb:facetargs'));
 		    var $this = jQuery(this);
 		    if ($this.hasClass('facetValueSelected')) {
 			$this.removeClass('facetValueSelected');