Blank item in combos will now contain a null JSONObject, instead of one identified by ''
authorAntonio Moreno <antonio.moreno@openbravo.com>
Wed, 26 Jan 2011 12:26:29 +0100
changeset 10139 21e24d50ff52
parent 10138 cc312a677f35
child 10140 7eb5aee711a2
Blank item in combos will now contain a null JSONObject, instead of one identified by ''
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/UIDefinition.java
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/UIDefinition.java	Wed Jan 26 11:45:32 2011 +0100
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/UIDefinition.java	Wed Jan 26 12:26:29 2011 +0100
@@ -357,8 +357,8 @@
       // If column is mandatory we add an initial blank value
       if (!field.getColumn().isMandatory()) {
         JSONObject entry = new JSONObject();
-        entry.put(JsonConstants.ID, "");
-        entry.put(JsonConstants.IDENTIFIER, "");
+        entry.put(JsonConstants.ID, (String) null);
+        entry.put(JsonConstants.IDENTIFIER, (String) null);
         comboEntries.add(entry);
       }
       for (FieldProvider fp : values) {
@@ -377,7 +377,11 @@
         } else {
           // In case the default value doesn't exist in the combo values, we choose the first one
           if (comboEntries.size() > 0) {
-            fieldProps.put("value", comboEntries.get(0).get(JsonConstants.ID));
+            if (comboEntries.get(0).has(JsonConstants.ID)) {
+              fieldProps.put("value", comboEntries.get(0).get(JsonConstants.ID));
+            } else {
+              fieldProps.put("value", (String) null);
+            }
           } else {
             fieldProps.put("value", "");
           }