details: /erp/devel/pi/rev/857750d432ee
changeset: 11936:857750d432ee
user: Martin Taal <martin.taal <at> openbravo.com>
date: Wed May 04 15:17:49 2011 +0200
summary: Related to issue 16872: Open in new tab: performance improvement
diffstat:
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
| 68 ++++++---
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-window.js
| 3 +-
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
| 3 +
3 files changed, 51 insertions(+), 23 deletions(-)
diffs (167 lines):
diff -r 1398bf486a83 -r 857750d432ee
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
Wed May 04 13:38:27 2011 +0200
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
Wed May 04 15:17:49 2011 +0200
@@ -263,6 +263,12 @@
OB.TestRegistry.register('org.openbravo.client.application.ChildTabSet_' +
this.tabId, this.viewForm);
}
}
+
+ if (this.defaultEditMode) {
+ // prevent the grid from showing very shortly, so hide it right away
+ this.viewGrid.hide();
+ }
+
},
// handles different ways by which an error can be passed from the
@@ -909,7 +915,7 @@
if (!currentSelectedRecord) {
return;
}
- rowNum = this.viewGrid.data.indexOf(currentSelectedRecord);
+ ro+wNum = this.viewGrid.data.indexOf(currentSelectedRecord);
if (next) {
newRowNum = rowNum + 1;
} else {
@@ -923,6 +929,33 @@
this.editRecord(newRecord);
},
+ openDirectTabView: function(showContent) {
+ if (this.parentTabSet && this.parentTabSet.getSelectedTab() !== this.tab) {
+ this.parentTabSet.selectTab(this.tab);
+ }
+
+ if (showContent) {
+ // this view is the last in the list then show it
+ if (this.parentTabSet) {
+ this.parentTabSet.setState(isc.OBStandardView.STATE_MID);
+ } else {
+ this.doHandleClick();
+ }
+ this.setMaximizeRestoreButtonState();
+
+ // show the form with the selected record
+ if (!this.isShowingForm) {
+ // hide the grid as it should not show up in a short flash
+ this.viewGrid.hide();
+ }
+ this.setAsActiveView();
+ }
+
+ if (this.parentView) {
+ this.parentView.openDirectTabView(false);
+ }
+ },
+
// is part of the flow to open all correct tabs when a user goes directly
// to a specific tab and record, for example by clicking a link in another
// window, see the description in ob-standard-window.js
@@ -947,13 +980,9 @@
this.viewGrid.targetOpenGrid = true;
}
- if (this.parentTabSet && this.parentTabSet.getSelectedTab() !==
this.tab) {
- this.parentTabSet.selectTab(this.tab);
- } else {
- // make sure that the content gets refreshed
- // refresh and open a child view when all is done
- this.doRefreshContents(true, true);
- }
+ // make sure that the content gets refreshed
+ // refresh and open a child view when all is done
+ this.doRefreshContents(true, true);
return true;
}
}
@@ -979,16 +1008,7 @@
}
}
}
-
- // no child tabs to open anymore, show ourselves as the default view
- // open this view
- if (this.parentTabSet) {
- this.parentTabSet.setState(isc.OBStandardView.STATE_MID);
- } else {
- this.doHandleClick();
- }
- this.setMaximizeRestoreButtonState();
-
+
// show the form with the selected record
if (!this.isShowingForm) {
var gridRecord = this.viewGrid.getSelectedRecord();
@@ -996,7 +1016,6 @@
this.editRecord(gridRecord);
}
}
- this.setAsActiveView();
// remove this info
delete this.standardWindow.directTabInfo;
@@ -1023,7 +1042,8 @@
// is actually a different parent selected, only then refresh children
var differentRecordId = !this.lastRecordSelected ||
!this.viewGrid.getSelectedRecord() ||
this.viewGrid.getSelectedRecord().id !== this.lastRecordSelected.id;
-
+ var selectedRecordId = this.viewGrid.getSelectedRecord().id;
+
this.updateLastSelectedState();
this.updateTabTitle();
this.toolBar.updateButtonState(this.isEditingGrid || this.isShowingForm);
@@ -1034,7 +1054,10 @@
if (this.childTabSet && differentRecordId) {
for (var i = 0; i < this.childTabSet.tabs.length; i++) {
tabViewPane = this.childTabSet.tabs[i].pane;
- tabViewPane.doRefreshContents(true);
+
+ if (!selectedRecordId || selectedRecordId !==
tabViewPane.parentRecordId) {
+ tabViewPane.doRefreshContents(true);
+ }
}
}
// and recompute the count:
@@ -1224,7 +1247,8 @@
tabSet.setTabTitle(tab, title);
}
- if (this.isRootView) {
+ // added check on tab as initially it is not set
+ if (this.isRootView && tab) {
// update the document title
document.title = 'Openbravo - ' + tab.title;
}
diff -r 1398bf486a83 -r 857750d432ee
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-window.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-window.js
Wed May 04 13:38:27 2011 +0200
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-window.js
Wed May 04 15:17:49 2011 +0200
@@ -311,6 +311,7 @@
for (var i = 0; i < this.views.length; i++) {
if (this.views[i].tabId === this.targetTabId) {
targetEntity = this.views[i].entity;
+ this.views[i].openDirectTabView(true);
break;
}
}
@@ -320,7 +321,7 @@
targetRecordId: (this.targetRecordId ? this.targetRecordId : null),
windowId: this.windowId
}, function(response, data, request){
- standardWindow.directTabInfo = data.result;
+ standardWindow.directTabInfo = data.result;
standardWindow.view.openDirectTab();
});
delete this.targetRecordId;
diff -r 1398bf486a83 -r 857750d432ee
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
Wed May 04 13:38:27 2011 +0200
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
Wed May 04 15:17:49 2011 +0200
@@ -774,6 +774,9 @@
} else {
parentPropertyFilterValue = selectedValues[0][OB.Constants.ID];
}
+
+ this.view.parentRecordId = parentPropertyFilterValue;
+
var fnd = false;
var innerCriteria = criteria.criteria;
for (i = 0; i < innerCriteria.length; i++) {
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today. Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits