|
@@ -246,6 +246,12 @@
|
|
|
onAll: function (name, args) {
|
|
onAll: function (name, args) {
|
|
|
return false;
|
|
return false;
|
|
|
},
|
|
},
|
|
|
|
|
+ onClickCell: function (field, value, row, $element) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ },
|
|
|
|
|
+ onDblClickCell: function (field, value, row, $element) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ },
|
|
|
onClickRow: function (item, $element) {
|
|
onClickRow: function (item, $element) {
|
|
|
return false;
|
|
return false;
|
|
|
},
|
|
},
|
|
@@ -374,6 +380,8 @@
|
|
|
|
|
|
|
|
BootstrapTable.EVENTS = {
|
|
BootstrapTable.EVENTS = {
|
|
|
'all.bs.table': 'onAll',
|
|
'all.bs.table': 'onAll',
|
|
|
|
|
+ 'click-cell.bs.table': 'onClickCell',
|
|
|
|
|
+ 'dbl-click-cell.bs.table': 'onDblClickCell',
|
|
|
'click-row.bs.table': 'onClickRow',
|
|
'click-row.bs.table': 'onClickRow',
|
|
|
'dbl-click-row.bs.table': 'onDblClickRow',
|
|
'dbl-click-row.bs.table': 'onDblClickRow',
|
|
|
'sort.bs.table': 'onSort',
|
|
'sort.bs.table': 'onSort',
|
|
@@ -1383,8 +1391,15 @@
|
|
|
|
|
|
|
|
// click to select by column
|
|
// click to select by column
|
|
|
this.$body.find('> tr > td').off('click').on('click', function () {
|
|
this.$body.find('> tr > td').off('click').on('click', function () {
|
|
|
- var $tr = $(this).parent();
|
|
|
|
|
- that.trigger('click-row', that.data[$tr.data('index')], $tr);
|
|
|
|
|
|
|
+ var $td = $(this),
|
|
|
|
|
+ $tr = $td.parent(),
|
|
|
|
|
+ item = that.data[$tr.data('index')],
|
|
|
|
|
+ cellIndex = $td[0].cellIndex,
|
|
|
|
|
+ $headerCell = that.$header.find('th:eq(' + cellIndex + ')'),
|
|
|
|
|
+ field = $headerCell.data('field'),
|
|
|
|
|
+ value = item[field];
|
|
|
|
|
+ that.trigger('click-cell', field, value, item, $td);
|
|
|
|
|
+ that.trigger('click-row', item, $tr);
|
|
|
// if click to select - then trigger the checkbox/radio click
|
|
// if click to select - then trigger the checkbox/radio click
|
|
|
if (that.options.clickToSelect) {
|
|
if (that.options.clickToSelect) {
|
|
|
if (that.header.clickToSelects[$tr.children().index($(this))]) {
|
|
if (that.header.clickToSelects[$tr.children().index($(this))]) {
|
|
@@ -1393,8 +1408,16 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
- this.$body.find('> tr').off('dblclick').on('dblclick', function () {
|
|
|
|
|
- that.trigger('dbl-click-row', that.data[$(this).data('index')], $(this));
|
|
|
|
|
|
|
+ this.$body.find('> tr > td').off('dblclick').on('dblclick', function () {
|
|
|
|
|
+ var $td = $(this),
|
|
|
|
|
+ $tr = $td.parent(),
|
|
|
|
|
+ item = that.data[$tr.data('index')],
|
|
|
|
|
+ cellIndex = $td[0].cellIndex,
|
|
|
|
|
+ $headerCell = that.$header.find('th:eq(' + cellIndex + ')'),
|
|
|
|
|
+ field = $headerCell.data('field'),
|
|
|
|
|
+ value = item[field];
|
|
|
|
|
+ that.trigger('dbl-click-cell', field, value, item, $td);
|
|
|
|
|
+ that.trigger('dbl-click-row', item, $tr);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
this.$body.find('> tr > td > .detail-icon').off('click').on('click', function () {
|
|
this.$body.find('> tr > td > .detail-icon').off('click').on('click', function () {
|