details: https://code.openbravo.com/erp/devel/pi/rev/e0b6ed220be4 changeset: 13233:e0b6ed220be4 user: Martin Taal <martin.taal <at> openbravo.com> date: Thu Jul 21 15:51:42 2011 +0200 summary: Fixes issue 17323: When you enter the product, the cursor jumps to the qty but the value in the field is not selected. Two changes: - when a next item gets the focus because a value in a picklist is chosen then the complete value gets selected - when the FIC call is done the selection is stored before the form gets disabled and restored after enabling the form
details: https://code.openbravo.com/erp/devel/pi/rev/645f8193cf87 changeset: 13234:645f8193cf87 user: Martin Taal <martin.taal <at> openbravo.com> date: Thu Jul 21 15:53:11 2011 +0200 summary: Solved small styling issue with suggestion box in quick run When the suggested values takes a smaller width then the white background becomes visible on the right in the suggestion box diffstat: modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js | 18 +++++- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-quick-launch.js | 32 +++++---- modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js | 24 +++++++ 3 files changed, 59 insertions(+), 15 deletions(-) diffs (131 lines): diff -r 6f6a12817c39 -r 645f8193cf87 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 Thu Jul 21 13:09:41 2011 +0200 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js Thu Jul 21 15:53:11 2011 +0200 @@ -414,6 +414,9 @@ setFocusInForm: function() { if (this.getFocusItem() && this.getFocusItem().isFocusable()) { this.getFocusItem().focusInItem(); + if (this.getFocusItem().doRestoreSelection) { + this.getFocusItem().doRestoreSelection(); + } this.view.lastFocusedItem = this.getFocusItem(); return; } @@ -718,7 +721,12 @@ if (previousAllItemsDisabled !== this.allItemsDisabled) { if (this.getFocusItem()) { if (this.allItemsDisabled) { - this.getFocusItem().blurItem(); + if (this.getFocusItem()) { + if (this.getFocusItem().doRememberSelection) { + this.getFocusItem().doRememberSelection(); + } + this.getFocusItem().blurItem(); + } this.setHandleDisabled(state); this.view.viewGrid.refreshEditRow(); } else { @@ -1254,6 +1262,14 @@ } else { this.focusInItem(nextItem); } + // note the formItem.selectValue does not seem to work + // in all cases, it seems the browser internally + // checks if a mouseevent was the cause of the selection + // in which case the selection is not update, .select() + // does what we want + if (!isc.isA.TextAreaItem(nextItem) && nextItem.getElement()) { + nextItem.getElement().select(); + } } }, diff -r 6f6a12817c39 -r 645f8193cf87 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-quick-launch.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-quick-launch.js Thu Jul 21 13:09:41 2011 +0200 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-quick-launch.js Thu Jul 21 15:53:11 2011 +0200 @@ -130,14 +130,18 @@ selectOnFocus: true, textMatchStyle: 'substring', width: OB.Styles.OBFormField.DefaultComboBox.quickRunWidth, - + // client filtering does not always work great... pickListProperties: { textMatchStyle: 'substring', bodyStyleName: OB.Styles.OBFormField.DefaultComboBox.pickListProperties.bodyStyleName }, pickListHeaderHeight: 0, - + + // this is to prevent this issue: + // http://forums.isomorphic.com/showthread.php?t=17949&goto=newpost + autoSizePickList: false, + getPickListFilterCriteria: function(){ // only filter on identifier var criteria = {}; @@ -145,18 +149,18 @@ return criteria; }, pickListFields: [{ - showValueIconOnly: true, - name: 'icon', - valueIcons: { - Process: this.nodeIcons.Process, - Report: this.nodeIcons.Report, - Form: this.nodeIcons.Form, - Window: this.nodeIcons.Window - } - }, { - name: OB.Constants.IDENTIFIER, - displayField: OB.Constants.IDENTIFIER, - valueField: OB.Constants.ID + showValueIconOnly: true, + name: 'icon', + valueIcons: { + Process: this.nodeIcons.Process, + Report: this.nodeIcons.Report, + Form: this.nodeIcons.Form, + Window: this.nodeIcons.Window + } + }, { + name: OB.Constants.IDENTIFIER, + displayField: OB.Constants.IDENTIFIER, + valueField: OB.Constants.ID }], autoFetchData: true, titleOrientation: 'top', diff -r 6f6a12817c39 -r 645f8193cf87 modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js --- a/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js Thu Jul 21 13:09:41 2011 +0200 +++ b/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js Thu Jul 21 15:53:11 2011 +0200 @@ -122,6 +122,30 @@ this.hasFocus = true; }, + doRememberSelection: function() { + var range = this.getSelectionRange(); + this._rememberedWasValueSelected = range && + range[0] < range[1] && range[1]; + }, + + doRestoreSelection: function() { + if (!this._rememberedWasValueSelected) { + return; + } + if (this._rememberedWasValueSelected) { + // note this has to be done with a delay/separate thread + // otherwise the browser will not select the complete value + this.delayCall('doSelectElement'); + } + delete this._rememberedWasValueSelected; + }, + + doSelectElement: function() { + if (this.getElement()) { + this.getElement().select(); + } + }, + blur: function(form, item){ if (item._hasChanged && form && form.handleItemChange) { form.handleItemChange(this); ------------------------------------------------------------------------------ 5 Ways to Improve & Secure Unified Communications Unified Communications promises greater efficiencies for business. UC can improve internal communications as well as offer faster, more efficient ways to interact with customers and streamline customer service. Learn more! http://www.accelacomm.com/jaw/sfnl/114/51426253/ _______________________________________________ Openbravo-commits mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openbravo-commits
