details: https://code.openbravo.com/erp/devel/pi/rev/1bc9b57dcfc1 changeset: 22678:1bc9b57dcfc1 user: Augusto Mauch <augusto.mauch <at> openbravo.com> date: Tue Mar 11 10:21:56 2014 +0100 summary: Related to issue 25534: Fix has been backed out because it is not proper
The fix did not work with the upgraded smartclient version details: https://code.openbravo.com/erp/devel/pi/rev/0c92bf8ef90f changeset: 22679:0c92bf8ef90f user: Augusto Mauch <augusto.mauch <at> openbravo.com> date: Tue Mar 11 12:56:41 2014 +0100 summary: Fixes issue 25947: Grouping is not working properly in the grid With the new version of smartclient it is no longer necessary to overwrite the Tree.getRange function. Now getRecord(1) should not return the record in the second position of the flattened tree, but the second root record, so it is no longer needed to getOpenList diffstat: modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js | 22 +--------- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js | 8 +--- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js | 4 - modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-action-button.js | 4 - 4 files changed, 2 insertions(+), 36 deletions(-) diffs (99 lines): diff -r 6599ad024496 -r 0c92bf8ef90f modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js Tue Mar 11 12:18:27 2014 +0100 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js Tue Mar 11 12:56:41 2014 +0100 @@ -1492,12 +1492,6 @@ storedFocusItem = this.getFocusItem(); } - if (this.view.viewGrid.isGrouped && this.isNew) { - // If a new record is added in a grouped grid, - // the grid has to be refreshed after the record has been actually saved - this.refreshGroupedGrid = true; - } - // store the value of the current focus item if (this.getFocusItem() && this.saveFocusItemChanged !== this.getFocusItem()) { this.getFocusItem().blur(this, this.getFocusItem()); @@ -1523,7 +1517,7 @@ callback = function (resp, data, req) { var index1, index2, view = form.view, localRecord, status = resp.status, - sessionProperties, keepSelection, gridRefreshCallback, theGrid, theId; + sessionProperties, keepSelection; if (this.hasOwnProperty('previousExplicitOffline')) { isc.Offline.explicitOffline = this.previousExplicitOffline; @@ -1655,20 +1649,6 @@ } } - if (this.refreshGroupedGrid) { - // Refresh the grid, open the root node of the new record, select the new recor and scroll it into view - theGrid = this.view.viewGrid; - theId = this.getValues()[OB.Constants.ID]; - gridRefreshCallback = function () { - var newRecord = theGrid.data.find('id', theId); - this.data.openFolder(theGrid.data.getParent(newRecord)); - theGrid.selectSingleRecord(newRecord); - theGrid.scrollToRow(theGrid.getRecordIndex(newRecord)); - }; - this.view.viewGrid.refreshGrid(gridRefreshCallback); - delete this.refreshGroupedGrid; - } - } else if (status === isc.RPCResponse.STATUS_VALIDATION_ERROR && resp.errors) { form.handleFieldErrors(resp.errors); view.standardWindow.autoSaveDone(view, false); diff -r 6599ad024496 -r 0c92bf8ef90f modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js Tue Mar 11 12:18:27 2014 +0100 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js Tue Mar 11 12:56:41 2014 +0100 @@ -312,12 +312,6 @@ this.groupTreeProperties = { grid: this, - // always return all records - getRange: function (start, end) { - return this.getOpenList( - this.root, this.openDisplayNodeType, null, this.sortDirection, this.openListCriteria, null, true).slice(start, end); - }, - setSort: function (sortSpecifier) { var i, fld, sortSpec = isc.clone(sortSpecifier), flds = this.grid.getAllFields(), @@ -1633,7 +1627,7 @@ //check whether newRecordsToBeIncluded contains records not part of the current grid and remove them. if (newRecordsToBeIncluded && newRecordsToBeIncluded.length > 0 && this.data) { for (i = 0; i < newRecordsToBeIncluded.length; i++) { - if (this.data.findByKey && !this.data.findByKey(newRecordsToBeIncluded[i])) { + if (!this.data.findByKey(newRecordsToBeIncluded[i])) { index = newRecordsToBeIncluded.indexOf(newRecordsToBeIncluded[i]); if (index !== -1) { newRecordsToBeIncluded.splice(index, 1); diff -r 6599ad024496 -r 0c92bf8ef90f modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js Tue Mar 11 12:18:27 2014 +0100 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js Tue Mar 11 12:56:41 2014 +0100 @@ -1757,10 +1757,6 @@ if (me.viewGrid.data.updateCacheData) { me.viewGrid.data.updateCacheData(data, req); } - if (me.viewGrid.isGrouped) { - // if the grid is group update its values to show the updated data - me.viewGrid.setEditValues(recordIndex, data[0]); - } me.viewGrid.selectRecord(me.viewGrid.getRecord(recordIndex)); me.viewGrid.refreshRow(recordIndex); me.viewGrid.redraw(); diff -r 6599ad024496 -r 0c92bf8ef90f modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-action-button.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-action-button.js Tue Mar 11 12:18:27 2014 +0100 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-action-button.js Tue Mar 11 12:56:41 2014 +0100 @@ -185,10 +185,6 @@ } currentView.refresh(null, autosaveDone, recordsAfterRefresh); } - if (contextView.viewGrid.isGrouped) { - // if the grid is grouped refresh the grid to show the records properly - contextView.viewGrid.refreshGrid(); - } }; if (this.autosave) { ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech _______________________________________________ Openbravo-commits mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openbravo-commits
