|
|
@@ -1,9 +1,9 @@
|
|
|
/**
|
|
|
* @author: Yura Knoxville
|
|
|
- * @version: v1.0.0
|
|
|
+ * @version: v1.1.0
|
|
|
*/
|
|
|
|
|
|
-!function ($) {
|
|
|
+(function ($) {
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
@@ -27,7 +27,7 @@
|
|
|
});
|
|
|
return flag ? str : '';
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
var groupBy = function (array , f) {
|
|
|
var groups = {};
|
|
|
array.forEach(function(o) {
|
|
|
@@ -41,7 +41,8 @@
|
|
|
|
|
|
$.extend($.fn.bootstrapTable.defaults, {
|
|
|
groupBy: false,
|
|
|
- groupByField: ''
|
|
|
+ groupByField: '',
|
|
|
+ groupByFormatter: undefined
|
|
|
});
|
|
|
|
|
|
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
|
|
@@ -72,7 +73,8 @@
|
|
|
$.each(groups, function(key, value) {
|
|
|
tableGroups.push({
|
|
|
id: index,
|
|
|
- name: key
|
|
|
+ name: key,
|
|
|
+ data: value
|
|
|
});
|
|
|
|
|
|
value.forEach(function(item) {
|
|
|
@@ -127,10 +129,13 @@
|
|
|
'</td>'
|
|
|
);
|
|
|
}
|
|
|
-
|
|
|
+ var formattedValue = item.name;
|
|
|
+ if (typeof(that.options.groupByFormatter) == "function") {
|
|
|
+ formattedValue = that.options.groupByFormatter(item.name, item.id, item.data);
|
|
|
+ }
|
|
|
html.push('<td',
|
|
|
sprintf(' colspan="%s"', visibleColumns),
|
|
|
- '>', item.name, '</td>'
|
|
|
+ '>', formattedValue, '</td>'
|
|
|
);
|
|
|
|
|
|
html.push('</tr>');
|
|
|
@@ -214,7 +219,6 @@
|
|
|
|
|
|
this.$selectItem.filter(filter).prop('checked', checked);
|
|
|
|
|
|
-
|
|
|
this.updateRows();
|
|
|
this.updateSelected();
|
|
|
if (checked) {
|
|
|
@@ -223,4 +227,4 @@
|
|
|
this.trigger(checked ? 'check-all' : 'uncheck-all', rows);
|
|
|
};
|
|
|
|
|
|
-}(jQuery);
|
|
|
+})(jQuery);
|