Skip to content

Commit

Permalink
add afterResizeDblClick callback and jqGridAfterResizeDblClick event
Browse files Browse the repository at this point in the history
New events will be called at the end of processing of the double-click
on the column resizer. It allows to make some custom actions after
autoResizing of columns for example.

See the following code as an example:

afterResizeDblClick: function (options) {
alert("column " + options.cmName + " is resized. The new column width is
" + options.cm.width);
}
  • Loading branch information
OlegKi committed Jan 3, 2016
1 parent 028858d commit a2d1a37
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 94 deletions.
10 changes: 6 additions & 4 deletions js/grid.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -4786,7 +4786,7 @@
pageX = $(this).data("pageX"),
cm = p.colModel[iColIndex];

if (pageX == null) {
if (pageX == null || cm == null) {
return false;
}
var arPageX = String(pageX).split(";"),
Expand All @@ -4795,9 +4795,10 @@
if (arPageX.length === 2 && (Math.abs(pageX1 - pageX2) > 5 || Math.abs(e.pageX - pageX1) > 5 || Math.abs(e.pageX - pageX2) > 5)) {
return false;
}
if (feedback.call(ts, "resizeDblClick", iColIndex, cm, e) && cm != null && cm.autoResizable) {
if (feedback.call(ts, "resizeDblClick", iColIndex, cm, e) && cm.autoResizable) {
$j.autoResizeColumn.call($self0, iColIndex);
}
feedback.call(ts, "afterResizeDblClick", { iCol: iColIndex, cm: cm, cmName: cm.name });

return false; // stop propagate
});
Expand Down Expand Up @@ -5294,7 +5295,7 @@
cm = p.colModel[iColIndex],
pageX = $(this).data("pageX") || $resizer.data("pageX");

if (pageX == null) {
if (pageX == null || cm == null) {
return false;
}
var arPageX = String(pageX).split(";"),
Expand All @@ -5305,9 +5306,10 @@
}

if (feedback.call(ts, "resizeDblClick", iColIndex, cm) &&
(resizerOffset.left - 1 <= e.pageX + delta && e.pageX + delta <= resizerOffset.left + $resizer.outerWidth() + 1) && cm != null && cm.autoResizable) {
(resizerOffset.left - 1 <= e.pageX + delta && e.pageX + delta <= resizerOffset.left + $resizer.outerWidth() + 1) && cm.autoResizable) {
$j.autoResizeColumn.call($self0, iColIndex);
}
feedback.call(ts, "afterResizeDblClick", { iCol: iColIndex, cm: cm, cmName: cm.name });
return false;
});
if (!p.pager) {
Expand Down

0 comments on commit a2d1a37

Please sign in to comment.