details: /erp/devel/pi/rev/c1a5461023c8
changeset: 10597:c1a5461023c8
user: Martin Taal <martin.taal <at> openbravo.com>
date: Sun Feb 13 23:26:38 2011 +0100
summary: Implicit filter enabled did not give correct empty data message
details: /erp/devel/pi/rev/101e6175fe4f
changeset: 10598:101e6175fe4f
user: Martin Taal <martin.taal <at> openbravo.com>
date: Sun Feb 13 23:30:47 2011 +0100
summary: Support refresh of parent record when adding/changing lines
diffstat:
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-grid.js
| 3 +
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view-datasource.js
| 92 ++++-----
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
| 45 ++++-
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
| 21 +-
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
| 8 +-
5 files changed, 112 insertions(+), 57 deletions(-)
diffs (truncated from 347 to 300 lines):
diff -r fdba29ca6846 -r 101e6175fe4f
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-grid.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-grid.js
Sun Feb 13 19:31:45 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-grid.js
Sun Feb 13 23:30:47 2011 +0100
@@ -241,6 +241,9 @@
if (!this.filterEditor) {
return false;
}
+ if (this.filterClause) {
+ return true;
+ }
for (var prop in criteria) {
if (criteria.hasOwnProperty(prop)) {
var value = criteria[prop];
diff -r fdba29ca6846 -r 101e6175fe4f
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view-datasource.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view-datasource.js
Sun Feb 13 19:31:45 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view-datasource.js
Sun Feb 13 23:30:47 2011 +0100
@@ -23,21 +23,21 @@
//
isc.ClassFactory.defineClass('OBViewDataSource', isc.OBRestDataSource);
-isc.OBViewDataSource.addProperties( {
+isc.OBViewDataSource.addProperties({
- showProgress : function(editedRecord) {
-
+ showProgress: function(editedRecord){
+
// don't show it, done to quickly
if (!editedRecord._showProgressAfterDelay) {
return;
}
-
+
if (editedRecord && editedRecord.editColumnLayout) {
if (!this.view.isShowingForm) {
editedRecord.editColumnLayout.toggleProgressIcon(true);
}
}
-
+
if (this.view.isShowingForm) {
var btn = this.view.toolBar.getLeftMember(isc.OBToolbar.TYPE_SAVE);
btn.customState = 'Progress';
@@ -45,22 +45,21 @@
btn.markForRedraw();
}
},
-
- hideProgress : function(editedRecord) {
+
+ hideProgress: function(editedRecord){
editedRecord._showProgressAfterDelay = false;
if (editedRecord && editedRecord.editColumnLayout) {
editedRecord.editColumnLayout.toggleProgressIcon(false);
}
-
+
// always remove the progress style here anyway
var btn = this.view.toolBar.getLeftMember(isc.OBToolbar.TYPE_SAVE);
btn.customState = '';
btn.resetBaseStyle();
btn.markForRedraw();
},
-
- performDSOperation : function(operationType, data, callback,
- requestProperties) {
+
+ performDSOperation: function(operationType, data, callback,
requestProperties){
// requestProperties.showPrompt = false;
// set the current selected record before the delay
var currentRecord = this.view.viewGrid.getSelectedRecord();
@@ -68,44 +67,39 @@
// only show progress after 200ms delay
currentRecord._showProgressAfterDelay = true;
// keep the edited record in the client context
+ requestProperties = requestProperties || {};
+ requestProperties.clientContext = requestProperties.clientContext || {};
+ requestProperties.clientContext.progressIndicatorSelectedRecord =
currentRecord;
+ this.delayCall('showProgress',
[requestProperties.clientContext.progressIndicatorSelectedRecord], 200);
+ }
+
+ // doing row editing
+ if (this.view.viewGrid.getEditRow() ||
+ this.view.viewGrid.getEditRow() === 0) {
if (!requestProperties.clientContext) {
requestProperties.clientContext = {};
}
- requestProperties.clientContext.progressIndicatorSelectedRecord =
currentRecord;
- this
- .delayCall(
- 'showProgress',
- [
requestProperties.clientContext.progressIndicatorSelectedRecord ],
- 200);
+ requestProperties.clientContext.editRow =
this.view.viewGrid.getEditRow();
}
- // doing row editing
- if (this.view.viewGrid.getEditRow() || this.view.viewGrid.getEditRow() ===
0) {
- if (!requestProperties.clientContext) {
- requestProperties.clientContext = {};
- }
- requestProperties.clientContext.editRow =
this.view.viewGrid.getEditRow();
- }
-
- var newRequestProperties = this.getTabInfoRequestProperties(this.view,
- requestProperties);
+ var newRequestProperties = this.getTabInfoRequestProperties(this.view,
requestProperties);
// standard update is not sent with operationType
var additionalPara = {
- _operationType : 'update',
- _noActiveFilter : true,
- sendOriginalIDBack: true
+ _operationType: 'update',
+ _noActiveFilter: true,
+ sendOriginalIDBack: true
};
isc.addProperties(newRequestProperties.params, additionalPara);
if (!newRequestProperties.dataSource) {
newRequestProperties.dataSource = this;
}
- this.Super('performDSOperation', [ operationType, data, callback,
- newRequestProperties ]);
+ this.Super('performDSOperation', [operationType, data, callback,
newRequestProperties]);
},
-
- // do special id-handling so that we can replace the old if with the new id
+
+ // do special id-handling so that we can replace the old if with the new
+ // id
// in the correct way, see the ob-view-grid.js editComplete method
- validateJSONRecord: function(record) {
+ validateJSONRecord: function(record){
record = this.Super('validateJSONRecord', arguments);
if (record && record._originalId) {
var newId = record.id;
@@ -115,17 +109,19 @@
return record;
},
- transformResponse : function(dsResponse, dsRequest, jsonData) {
-
- if (dsRequest.clientContext &&
dsRequest.clientContext.progressIndicatorSelectedRecord) {
+ transformResponse: function(dsResponse, dsRequest, jsonData){
+
+ if (dsRequest.clientContext &&
+ dsRequest.clientContext.progressIndicatorSelectedRecord) {
this.hideProgress(dsRequest.clientContext.progressIndicatorSelectedRecord);
}
if (jsonData) {
- var errorStatus = !jsonData.response || jsonData.response.status ===
'undefined' || jsonData.response.status !== isc.RPCResponse.STATUS_SUCCESS;
+ var errorStatus = !jsonData.response ||
+ jsonData.response.status === 'undefined' ||
+ jsonData.response.status !== isc.RPCResponse.STATUS_SUCCESS;
if (errorStatus) {
- var handled = this.view.setErrorMessageFromResponse(dsResponse,
- jsonData, dsRequest);
-
+ var handled = this.view.setErrorMessageFromResponse(dsResponse,
jsonData, dsRequest);
+
if (!handled && !dsRequest.willHandleError) {
OB.KernelUtilities.handleSystemException(error.message);
}
@@ -138,7 +134,7 @@
}
return this.Super('transformResponse', arguments);
},
-
+
// ** {{{ getTabInfoRequestProperties }}} **
//
// Adds tab and module information to the requestProperties.
@@ -149,13 +145,13 @@
// Return:
// * Original requestProperties including the new module and tab
// properties.
- getTabInfoRequestProperties : function(theView, requestProperties) {
+ getTabInfoRequestProperties: function(theView, requestProperties){
if (theView && theView.tabId) {
var tabParam = {
- params : {
- windowId : theView.standardWindow.windowId,
- tabId : theView.tabId,
- moduleId : theView.moduleId
+ params: {
+ windowId: theView.standardWindow.windowId,
+ tabId: theView.tabId,
+ moduleId: theView.moduleId
}
};
if (requestProperties) {
diff -r fdba29ca6846 -r 101e6175fe4f
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
Sun Feb 13 19:31:45 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
Sun Feb 13 23:30:47 2011 +0100
@@ -1157,6 +1157,11 @@
return;
}
+ var me = this;
+ var formRefresh = function() {
+ me.viewForm.refresh();
+ };
+
if (!this.isShowingForm) {
this.viewGrid.refreshGrid();
} else {
@@ -1164,12 +1169,12 @@
if (this.viewForm.hasChanged) {
var callback = function(ok){
if (ok) {
- this.viewGrid.refreshGrid();
+ this.viewGrid.refreshGrid(formRefresh);
}
};
isc.ask(OB.I18N.getLabel('OBUIAPP_ConfirmRefresh'), callback);
} else {
- this.viewGrid.refreshGrid();
+ this.viewGrid.refreshGrid(formRefresh);
}
}
if (refreshCallback) {
@@ -1177,6 +1182,42 @@
}
},
+ refreshParentRecord: function() {
+ if (this.parentView) {
+ this.parentView.refreshCurrentRecord();
+ }
+ },
+
+ refreshCurrentRecord: function() {
+ if (!this.viewGrid.getSelectedRecord()) {
+ return;
+ }
+ var record = this.viewGrid.getSelectedRecord();
+ var criteria = {};
+ criteria[OB.Constants.ID] = record.id;
+ // force a fetch from the server
+ criteria._dummy = new Date().getTime();
+
+ var me = this;
+ var callback = function(resp, data, req) {
+ // this line does not work, but it should:
+// me.getDataSource().updateCaches(resp, req);
+ // therefore doe an explicit update of the visual components
+ if (me.isShowingForm) {
+ me.viewForm.refresh();
+ }
+ if (me.viewGrid.data) {
+ var recordIndex =
me.viewGrid.getRecordIndex(me.viewGrid.getSelectedRecord());
+ me.viewGrid.data.updateCacheData(data, req);
+ me.viewGrid.selectRecord(me.viewGrid.getRecord(recordIndex));
+ me.viewGrid.markForRedraw();
+ }
+ };
+
+ this.getDataSource().fetchData(criteria, callback);
+ this.refreshParentRecord();
+ },
+
saveRow: function(){
if (this.isEditingGrid) {
this.viewGrid.endEditing();
diff -r fdba29ca6846 -r 101e6175fe4f
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
Sun Feb 13 19:31:45 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
Sun Feb 13 23:30:47 2011 +0100
@@ -358,6 +358,17 @@
setDisabled: function(state) {
this.allItemsDisabled = state;
+ var editRow = this.view.viewGrid.getEditRow();
+ if (editRow || editRow === 0) {
+ this.view.viewGrid.refreshRow(editRow);
+ }
+ },
+
+ refresh: function() {
+ var criteria = {
+ id: this.getValue(OB.Constants.ID)
+ };
+ this.fetchData(criteria);
},
processColumnValue: function(columnName, columnValue, editValues){
@@ -516,7 +527,7 @@
},
itemChanged: function(item, newValue){
- this.handleItemChange(item);
+ this.itemChangeActions(item);
},
// these actions are done when the user types in a field
@@ -602,8 +613,6 @@
view.viewGrid.targetRecordId = data.id;
view.viewGrid.refreshContents();
}
-
- this.setNewState(false);
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits