Skip to content

Commit

Permalink
Merge pull request #66 from Multiplicom/bugfix/callback-context-loss
Browse files Browse the repository at this point in the history
fix: don't lose context in callback
  • Loading branch information
michielvermeir committed Sep 18, 2019
2 parents b5e1d5e + 4866736 commit 479406b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Panels/PanelTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,12 +442,17 @@ define([
* Sets the html code for the table content
*/
panel.renderTableContent = function() {
if (this) {
panel = this;
}

panel._tableRowCount = panel._tableData.getRowCount();
var rowFirst = panel._tableOffset;
var rowLast = Math.min(panel._tableRowCount-1, panel._tableOffset+panel._tableLineCount-1);

if (!panel._tableData.requireRowRange(rowFirst, rowLast, panel.renderTableContent, panel.renderFail))
if (!panel._tableData.requireRowRange(rowFirst, rowLast, panel.renderTableContent.bind(panel), panel.renderFail)) {
return;
}

var $ElRightBody = $('#'+panel._divid_rightBody);
var $ElLeftBody = $('#'+panel._divid_leftBody);
Expand Down Expand Up @@ -748,7 +753,7 @@ define([
var rowLast = Math.min(panel._tableRowCount-1, panel._tableOffset+panel._tableLineCount-1);
diff = panel._tableOffset - tableOffsetPrev; // Corrected difference

if (!panel._tableData.requireRowRange(rowFirst, rowLast, panel.renderTableContent, panel.renderFail))
if (!panel._tableData.requireRowRange(rowFirst, rowLast, panel.renderTableContent.bind(panel), panel.renderFail))
return; // We need to fetch data first - no fast update here - full rendering will happen

if (diff > 0) {
Expand Down

0 comments on commit 479406b

Please sign in to comment.