[table] use cell text content when cubicweb:sortvalue is not defined (closes #2093183)
--- a/web/data/cubicweb.js Fri Dec 16 12:30:12 2011 +0100
+++ b/web/data/cubicweb.js Fri Dec 16 14:35:20 2011 +0100
@@ -84,11 +84,13 @@
},
sortValueExtraction: function (node) {
- var sortvalue = jQuery(node).attr('cubicweb:sortvalue');
- if (sortvalue === undefined) {
- return '';
- }
- return cw.evalJSON(sortvalue);
+ var $node = $(node);
+ var sortvalue = $node.attr('cubicweb:sortvalue');
+ // No metadata found, use cell content as sort key
+ if (sortvalue === undefined) {
+ return $node.text();
+ }
+ return cw.evalJSON(sortvalue);
}
});