details: https://code.openbravo.com/erp/devel/pi/rev/d2eadb91053e
changeset: 23397:d2eadb91053e
user: Shankar Balachandran <shankar.balachandran <at> openbravo.com>
date: Thu May 29 09:51:07 2014 +0530
summary: Fixes issue 0026700: Wrong request after filtering in a field
obblur event, if more than one records were selected in filter, an additional
request was being done.
Prevented the request in this case as the grid is already filtered.
diffstat:
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk-filter.js
| 31 ++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diffs (41 lines):
diff -r cfbf9acc0ba2 -r d2eadb91053e
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk-filter.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk-filter.js
Wed May 28 17:07:36 2014 +0000
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk-filter.js
Thu May 29 09:51:07 2014 +0530
@@ -156,6 +156,37 @@
return this.Super('destroy', arguments);
},
+ // When the selected value is part of the pickList the grid is already
filtered,
+ // so no additional request is required. But when there is a keyword entered,
+ // the grid has to be filtered. Refer issue,
https://issues.openbravo.com/view.php?id=26700.
+ handleEditorExit: function () {
+ var value = this.getValue(),
+ performFetch = false,
+ rows,i;
+ if (this.pickListProperties && this.pickList.data &&
(this.pickList.data.allRows || this.pickList.data.localData)) {
+ rows = this.pickList.data.allRows || this.pickList.data.localData;
+ }
+ if (value && isc.isA.Array(value) && value.length > 0 && rows) {
+ for (i = 0; i < value.length; i++) {
+ if (value[i].indexOf("==") === 0) {
+ value[i] = value[i].substring(2, value[i].length);
+ if (rows.find('name', value[i]) === undefined) {
+ performFetch = true;
+ }
+ }
+ }
+ } else {
+ if (rows && rows.find('name', value)) {
+ performFetch = true;
+ }
+ }
+ if (performFetch) {
+ this.Super('handleEditorExit', arguments);
+ } else {
+ return value;
+ }
+ },
+
// note: can't override changed as it is used by the filter editor
// itself, see the RecordEditor source code and the changed event
change: function (form, item, value, oldValue) {
------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits