stop invalidation of not visible nextmatch, happens when switching from infolog to crm-view in addressbook

This commit is contained in:
Ralf Becker 2015-04-28 15:59:21 +00:00
parent 812a9bbe8d
commit e74f29fdaa

View File

@ -143,7 +143,7 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrin
createNamespace: true, createNamespace: true,
columns: [], columns: [],
// Current view, either row or tile. We store it here as controllers are // Current view, either row or tile. We store it here as controllers are
// recreated when the template changes. // recreated when the template changes.
view: 'row', view: 'row',
@ -159,7 +159,7 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrin
// Directly set current col_filters from settings // Directly set current col_filters from settings
jQuery.extend(this.activeFilters.col_filter, this.options.settings.col_filter); jQuery.extend(this.activeFilters.col_filter, this.options.settings.col_filter);
/* /*
Process selected custom fields here, so that the settings are correctly Process selected custom fields here, so that the settings are correctly
set before the row template is parsed set before the row template is parsed
@ -308,6 +308,14 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrin
}); });
} }
} }
// stop invalidation in no visible tabs
$j(this.getInstanceManager().DOMContainer.parentNode).on('hide.et2_nextmatch', jQuery.proxy(function(e) {
this.controller._grid.doInvalidate = false;
},this));
$j(this.getInstanceManager().DOMContainer.parentNode).on('show.et2_nextmatch', jQuery.proxy(function(e) {
this.controller._grid.doInvalidate = true;
},this));
return true; return true;
}, },
@ -1129,7 +1137,7 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrin
// Set the view // Set the view
this.controller._view = this.view; this.controller._view = this.view;
// Load the initial order // Load the initial order
/*this.controller.loadInitialOrder(this._getInitialOrder( /*this.controller.loadInitialOrder(this._getInitialOrder(
this.options.settings.rows, this.options.settings.row_id this.options.settings.rows, this.options.settings.row_id
@ -1884,13 +1892,13 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrin
beforePrint: function() { beforePrint: function() {
// Add the class, if needed // Add the class, if needed
this.div.addClass('print'); this.div.addClass('print');
// Trigger resize, so we can fit on a page // Trigger resize, so we can fit on a page
this.dynheight.outerNode.css('max-width',this.div.css('max-width')); this.dynheight.outerNode.css('max-width',this.div.css('max-width'));
this.resize(); this.resize();
// Reset height to auto (after width resize) so there's no restrictions // Reset height to auto (after width resize) so there's no restrictions
this.dynheight.innerNode.css('height', 'auto'); this.dynheight.innerNode.css('height', 'auto');
// Check for rows that aren't loaded yet, or lots of rows // Check for rows that aren't loaded yet, or lots of rows
var range = this.controller._grid.getIndexRange(); var range = this.controller._grid.getIndexRange();
this.old_height = this.controller._grid._scrollHeight; this.old_height = this.controller._grid._scrollHeight;
@ -1914,7 +1922,7 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrin
{ {
value = total; value = total;
} }
// If they want the whole thing, treat it as all // If they want the whole thing, treat it as all
if(button == 'dialog[ok]' && value == this.controller._grid.getTotalCount()) if(button == 'dialog[ok]' && value == this.controller._grid.getTotalCount())
{ {
@ -1952,14 +1960,14 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrin
{ {
ctx.prefix = nm.controller.dataStorePrefix; ctx.prefix = nm.controller.dataStorePrefix;
} }
nm.controller.dataFetch({start:count, num_rows: Math.min(value,200)}, function(data) { nm.controller.dataFetch({start:count, num_rows: Math.min(value,200)}, function(data) {
// Keep track // Keep track
if(data && data.order) if(data && data.order)
{ {
fetchedCount += data.order.length; fetchedCount += data.order.length;
} }
nm.controller._fetchCallback.apply(this, arguments); nm.controller._fetchCallback.apply(this, arguments);
if(fetchedCount >= value) if(fetchedCount >= value)
{ {
if(cancel) if(cancel)
@ -1977,17 +1985,17 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrin
$j('.egwGridView_scrollarea',this.div).css('overflow-y','hidden'); $j('.egwGridView_scrollarea',this.div).css('overflow-y','hidden');
// Show it all // Show it all
$j('.egwGridView_scrollarea',this.div).css('height','auto'); $j('.egwGridView_scrollarea',this.div).css('height','auto');
// Grid needs to redraw before it can be printed, so wait // Grid needs to redraw before it can be printed, so wait
window.setTimeout(jQuery.proxy(function() { window.setTimeout(jQuery.proxy(function() {
dialog.destroy(); dialog.destroy();
// Should be OK to print now // Should be OK to print now
defer.resolve(); defer.resolve();
},nm),ET2_GRID_INVALIDATE_TIMEOUT); },nm),ET2_GRID_INVALIDATE_TIMEOUT);
} }
},ctx); },ctx);
count += 200; count += 200;
} while (count < value) } while (count < value)
@ -1996,7 +2004,7 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrin
else else
{ {
// Don't need more rows, limit to requested and finish // Don't need more rows, limit to requested and finish
// Show it all // Show it all
$j('.egwGridView_scrollarea',this.div).css('height','auto'); $j('.egwGridView_scrollarea',this.div).css('height','auto');
@ -2036,7 +2044,7 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrin
* in beforePrint() * in beforePrint()
*/ */
afterPrint: function() { afterPrint: function() {
this.div.removeClass('print'); this.div.removeClass('print');
// Put scrollbar back // Put scrollbar back
@ -2045,7 +2053,7 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrin
// Correct size of grid, and trigger resize to fix it // Correct size of grid, and trigger resize to fix it
this.controller._grid.setScrollHeight(this.old_height); this.controller._grid.setScrollHeight(this.old_height);
delete this.old_height; delete this.old_height;
// Remove CSS rule hiding extra rows // Remove CSS rule hiding extra rows
if(this.print_row_selector) if(this.print_row_selector)
{ {