Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Javascript error using setAddUnknownValues and setSpecialValues

    Hello,

    I am trying to create a comboBox that takes in specific values that specific to a database read. I have the following comboBox:
    Code:
    final ComboBoxItem cvidBoxItem = new ComboBoxItem("cvid", "Cvid");
    cvidBoxItem.setAddUnknownValues(false);
    cvidBoxItem.setTextMatchStyle(TextMatchStyle.[I]SUBSTRING[/I]);
    cvidBoxItem.setOptionDataSource(cvidCodesDS.[I]getInstance[/I]());
    cvidBoxItem.setDisplayField("formattedName");
    cvidBoxItem.setValueField("objectid");
    cvidBoxItem.setAllowEmptyValue(true);
    cvidBoxItem.setAlign(Alignment.[I]CENTER[/I]);
    LinkedHashMap<String,String> hashMap = new LinkedHashMap<String,String>();
    hashMap.put("0", "None");
    cvidBoxItem.setSpecialValues(hashMap);
    however, when I compile this, it ends up throwing a javascript error of :
    Code:
    Uncaught TypeError: this.pickerClearButton is undefined
        isc_ComboBoxItem_setAddUnknownValues
        isc_Class_setProperties
        isc_ListGrid_makeEditForm
        isc_ListGrid_showInlineEditor
        isc_ListGrid__startEditing
        isc_c_Class_fireCallback
        isc_c_Timer__fireTimeout
    this also prevents me from opening the listGrid editor on that page.
    whenever I remove setAddUnknownValues, or set it to true, I don't have this problem, but having specific responses is critical to this application. Feel free to ask more questions, and i will take any advice you give.




    [/CODE]

    #2
    This ComboBox is being used for grid inline editing, so clearly there’s a lot more code involved, and we don’t have enough to reproduce the problem (if you drop this code into a grid editing sample as editorProperties, there’s no crash).

    Also remember to give your exact version and product you’re using.

    Comment


      #3
      I am using smartGWT:
      v12.0p_2019-07-03/LGPL Development Only

      Code:
      final ComboBoxItem cvidBoxItem = new ComboBoxItem("cvidCode", "Cvid");
      cvidBoxItem.setAddUnknownValues(false);
      cvidBoxItem.setTextMatchStyle(TextMatchStyle.[I]SUBSTRING[/I]);
      cvidBoxItem.setOptionDataSource(cvidCodesDS.[I]getInstance[/I]());
      cvidBoxItem.setDisplayField("formattedName");
      cvidBoxItem.setValueField("objectid");
      cvidBoxItem.setAllowEmptyValue(true);
      cvidBoxItem.setAlign(Alignment.[I]CENTER[/I]);
      LinkedHashMap<String,String> cvidBoxMap = new LinkedHashMap<String,String>();
      cvidBoxMap.put("0", "None");
      cvidBoxItem.setSpecialValues(cvidBoxMap);
      
      cvidFormattedIdField.setOptionDataSource(cvidCodesDS.[I]getInstance[/I]());
      cvidFormattedIdField.setEditorProperties(cvidBoxItem);
      cvidFormattedIdField.setDisplayField("id");
      cvidFormattedIdField.setValueField("objectid");
      cvidFormattedIdField.setSortByDisplayField(true);
      cvidFormattedIdField.setRequired(false);
      cvidFormattedIdField.setCanGroupBy(false);
      cvidFormattedIdField.setAlign(Alignment.[I]CENTER[/I]);
      cvidFormattedIdField.setWidth(128);
      cvidFormattedIdField.setCellFormatter(new CellFormatter() {
      public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
      Integer nill = 0; if(value.hashCode() == nill.hashCode()) return null; return value.toString(); } });
      I can add more if need be. I am very. very new to smartGWT so I am still learning how things work.

      Comment


        #4
        This build is almost 2 years out of date, so installing the latest patched build is a good idea (see smartclient.com/builds). You could be pointlessly chasing a bug that has been fixed for a long time, and we don't try to reproduce against out-of-date builds.

        As far as the test code, it remains not enough to reproduce the claimed problem - see the Debugging overview for advance on how to set up a test case that will allow other to reproduce a problem you're having.

        Comment

        Working...
        X