|
@@ -220,7 +220,12 @@
|
|
|
this.$el.find('tbody tr').each(function () {
|
|
this.$el.find('tbody tr').each(function () {
|
|
|
var row = {};
|
|
var row = {};
|
|
|
$(this).find('td').each(function (i) {
|
|
$(this).find('td').each(function (i) {
|
|
|
- row[that.options.columns[i].field] = $(this).html();
|
|
|
|
|
|
|
+ var value = $(this).html();
|
|
|
|
|
+ var classes = $(this).attr('class') || '';
|
|
|
|
|
+ row[that.options.columns[i].field] = {
|
|
|
|
|
+ 'value': value,
|
|
|
|
|
+ 'class': classes
|
|
|
|
|
+ };
|
|
|
});
|
|
});
|
|
|
data.push(row);
|
|
data.push(row);
|
|
|
});
|
|
});
|
|
@@ -336,6 +341,16 @@
|
|
|
if (typeof sorter === 'string') {
|
|
if (typeof sorter === 'string') {
|
|
|
return order * eval(sorter + '(a[name], b[name])'); // eval ?
|
|
return order * eval(sorter + '(a[name], b[name])'); // eval ?
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ if (typeof a === 'object' && typeof b === 'object') {
|
|
|
|
|
+ if (a[name].value === b[name].value) {
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (a[name].value < b[name].value) {
|
|
|
|
|
+ return order * -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (a[name] === b[name]) {
|
|
if (a[name] === b[name]) {
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
@@ -711,6 +726,12 @@
|
|
|
'</td>'].join('');
|
|
'</td>'].join('');
|
|
|
} else {
|
|
} else {
|
|
|
value = typeof value === 'undefined' ? that.options.undefinedText : value;
|
|
value = typeof value === 'undefined' ? that.options.undefinedText : value;
|
|
|
|
|
+ var classes = '';
|
|
|
|
|
+
|
|
|
|
|
+ if (typeof value == 'object') {
|
|
|
|
|
+ classes = value['class'];
|
|
|
|
|
+ value = value.value;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
text = that.options.cardView ?
|
|
text = that.options.cardView ?
|
|
|
['<div class="card-view">',
|
|
['<div class="card-view">',
|
|
@@ -718,7 +739,7 @@
|
|
|
getPropertyFromOther(that.options.columns, 'field', 'title', field)),
|
|
getPropertyFromOther(that.options.columns, 'field', 'title', field)),
|
|
|
sprintf('<span class="value">%s</span>', value),
|
|
sprintf('<span class="value">%s</span>', value),
|
|
|
'</div>'].join('') :
|
|
'</div>'].join('') :
|
|
|
- [sprintf('<td %s>', style),
|
|
|
|
|
|
|
+ [sprintf('<td %s class="%s">', style, classes),
|
|
|
value,
|
|
value,
|
|
|
'</td>'].join('');
|
|
'</td>'].join('');
|
|
|
}
|
|
}
|