[table] use cell text content when cubicweb:sortvalue is not defined (closes #2093183)

authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
changeset2dedcc15208d
branchdefault
phasepublic
hiddenno
parent revision#0a927fe4541b [controllers] deprecate JSonController and implement AjaxController / ajax-func registry (closes #2110265)
child revision#85ade620056c [views] (in/outof)context views now use directly dc_(long)_title() (closes #2110235)
files modified by this revision
web/data/cubicweb.js
# HG changeset patch
# User Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
# Date 1324042520 -3600
# Fri Dec 16 14:35:20 2011 +0100
# Node ID 2dedcc15208df152119bfe7fdc69b921bfed8b6d
# Parent 0a927fe4541b8ce0b611b939bf425ed59ed86dc6
[table] use cell text content when cubicweb:sortvalue is not defined (closes #2093183)

diff --git a/web/data/cubicweb.js b/web/data/cubicweb.js
@@ -82,15 +82,17 @@
1          }
2          return src;
3      },
4 
5      sortValueExtraction: function (node) {
6 -	var sortvalue = jQuery(node).attr('cubicweb:sortvalue');
7 -	if (sortvalue === undefined) {
8 -	    return '';
9 -	}
10 -	return cw.evalJSON(sortvalue);
11 +        var $node = $(node);
12 +        var sortvalue = $node.attr('cubicweb:sortvalue');
13 +        // No metadata found, use cell content as sort key
14 +        if (sortvalue === undefined) {
15 +            return $node.text();
16 +        }
17 +        return cw.evalJSON(sortvalue);
18      }
19  });
20 
21 
22  cw.utils = new Namespace('cw.utils');