details: /erp/devel/pi/rev/d3d0bbf0cb67
changeset: 11413:d3d0bbf0cb67
user: Iván Perdomo <ivan.perdomo <at> openbravo.com>
date: Thu Mar 31 11:10:05 2011 +0200
summary: Issue 16551: Removes default (0) from attribute set value
details: /erp/devel/pi/rev/9498451f1823
changeset: 11414:9498451f1823
user: Iván Perdomo <ivan.perdomo <at> openbravo.com>
date: Thu Mar 31 11:13:01 2011 +0200
summary: Fixes issue 16551: Removed overrided setValue method
- The setValue method was doing some operation to set/hide a clear icon, the
default setValue already takes care of it.
- The call to showIcon() was calling the setValue again with undefined value
diffstat:
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
| 15 +-------
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/PAttributeSearchUIDefinition.java
| 20 ++++++++++
2 files changed, 21 insertions(+), 14 deletions(-)
diffs (59 lines):
diff -r d56c1d57f138 -r 9498451f1823
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
Thu Mar 31 10:40:07 2011 +0200
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
Thu Mar 31 11:13:01 2011 +0200
@@ -116,20 +116,7 @@
wrap: false,
clipValue: true,
validateOnChange: true,
-
- setValue: function(value){
- var ret = this.Super('setValue', arguments);
- // in this case the clearIcon needs to be shown or hidden
- if (!this.disabled && !this.required) {
- if (value) {
- this.showIcon(this.instanceClearIcon);
- } else {
- this.hideIcon(this.instanceClearIcon);
- }
- }
- return ret;
- },
-
+
// NOTE: FormItem don't have initWidget but use init
init: function(){
this.instanceClearIcon = isc.shallowClone(this.clearIcon);
diff -r d56c1d57f138 -r 9498451f1823
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/PAttributeSearchUIDefinition.java
---
a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/PAttributeSearchUIDefinition.java
Thu Mar 31 10:40:07 2011 +0200
+++
b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/PAttributeSearchUIDefinition.java
Thu Mar 31 11:13:01 2011 +0200
@@ -18,10 +18,30 @@
*/
package org.openbravo.client.kernel.reference;
+import org.codehaus.jettison.json.JSONObject;
+import org.openbravo.model.ad.ui.Field;
+
public class PAttributeSearchUIDefinition extends FKSearchUIDefinition {
@Override
public String getFormEditorType() {
return "OBPAttributeSearchItem";
}
+
+ @Override
+ public String getFieldProperties(Field field, boolean getValueFromSession) {
+ // TODO: This is hack to remove the default attribute set 0 in grid view,
it should be removed
+ // when the strategy of display logic is defined for grid view
+ String fieldProperties = super.getFieldProperties(field,
getValueFromSession);
+ try {
+ JSONObject o = new JSONObject(fieldProperties);
+ if (o.get("value") != null && o.get("value").equals("0")) {
+ o.put("value", "");
+ }
+ return o.toString();
+ } catch (Exception e) {
+ log.error("Error trying to modify JSON object: " + fieldProperties, e);
+ }
+ return fieldProperties;
+ }
}
------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself;
WebMatrix provides all the features you need to develop and
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits