Announcement

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

    Problem with Mulitiple select item

    Hi,
    I'm facing a problem with validation on SelectItem.setMultiple(true).

    Datasource side code:
    ----------------------
    Code:
    DataSourceEnumField dsField=new DataSourceEnumField("ITEMS");
    		LinkedHashMap<String,String> map=new LinkedHashMap<String, String>();
    		map.put("ITEM1", "ITEM1");
    		map.put("ITEM2", "ITEM2");
    		map.put("ITEM3", "ITEM3");
    		map.put("ITEM4", "ITEM4");
    		
    		dsField.setMultiple(true);
    		dsField.setValueMap(map);
    		ds.setFields(dsField);
    Client Code
    ------------
    Code:
    final DynamicForm dForm=new DynamicForm();
    		dForm.setDataSource(ds);
    		SelectItem selItem=new SelectItem("ITEMS", "Select Items");
    		selItem.setMultiple(true);
    		selItem.setMultipleAppearance(MultipleAppearance.PICKLIST);
    Upon submitting the form, i'm validating the form. As i set multiple true on both DS and form side, it should accept multiple values selected and should not get validation error for the SelectItem because DataSourceEnumField accepts array of strings(as per api) when we set multiple true. Eventhough i'm getting proper values in, form.getValues(), its showing validation error "Not a valid option" on UI. I couldn't understand the problem.

    Please tell me if i'm doing wrong or do i need to set anything.

    PFA testcase and error screenshot.
    Attached Files

    #2
    Please post all of your versions (always do this) and please try this against the latest nightly.

    Comment


      #3
      Thank you very much Isomorphic for quick response.

      Sorry for not to mention my versions.
      Earlier i am using:
      smartgwt-2.4 (client only)
      gwt2.2

      Now i tested with smartgwt-2.5. Its working as expected.

      If you dont mind, i have one request. Please append version names while making smartgwt jars. Only zip contains version names but not the jars. In eclipse im adding jars only to class path. Because i downloaded 2.4 long back, I forgot where i downloaded. I coundn't find versions in the jars. I searched the whole drive and found the zip and came to know that was using 2.4 version.

      Comment


        #4
        The version is logged at server startup and is also shown in the lower left hand corner of the Developer Console. We don't plan to add versions to .jar file names.

        Comment


          #5
          For me version is not getting logged at server startup (its not showing on console view in eclipse). Might be this is because im using inbuilt Jetty server instead of App Engine server.

          PFA developer console. There i dint find version, its just showing date when the jar was built. Is that what you are talking about?

          Anyway, i can find the version based on the date. Thanks for the info.
          Attached Files

          Comment


            #6
            The date stamp and edition is shown in both places, regardless of what servlet engine or environment is used. This version string is the version you need for posting here, and also serves for comparing two builds (obviously).

            Comment


              #7
              Ok Got It. Thanks.

              I've got another doubt. If we setEditorType on a form field, does it use all properties defined for that Editor.
              As i've defined form layout as 4 columns. For one field i want break that and should come in new line.

              PFA modified file and screenshots.

              Code version1:
              ----------
              Code:
              SelectItem selItem=new SelectItem();
              		selItem.setMultiple(true);
              		selItem.setMultipleAppearance(MultipleAppearance.PICKLIST);
              		selItem.setStartRow(true); /*apply start row on selectitem*/
              		dForm.getField("ITEMS").setEditorType(selItem);
                               //dForm.getField("ITEMS").setStartRow(true);
              In this case, its not showing ITEMS field in new line.

              Code Version2
              ----------
              Code:
              SelectItem selItem=new SelectItem();
              		selItem.setMultiple(true);
              		selItem.setMultipleAppearance(MultipleAppearance.PICKLIST);
              		//selItem.setStartRow(true); 
              		
              		dForm.getField("ITEMS").setEditorType(selItem);
              		dForm.getField("ITEMS").setStartRow(true); /*apply start row on actual form field item*/
              In this case its showing ITEMS field in new line(as expected).

              I couldnt find the actual difference in the code. Doesnt' it use all properties defined for SelectItem.

              As per api there is limitation on eventhanders but they didnt' mention about other properties like this.

              setEditorType API:
              -----------------
              Note : When you supply a custom FormItem via setEditorType(), you're really providing properties which are then used to create multiple FormItems (eg, in grids, forms and trees) and there's an underlying limitation here where event handlers have to be written to dynamically receive the actual FormItem rather than relying on "this" (because there's more than one "this").

              Does limitation exists for these kind of properties also? If so what kind of properties i can use on SelectItem to inheret to FormItem field?

              Please clarify.
              Attached Files

              Comment


                #8
                Don't try to customize fields after data binding, provide overriding fields instead. See the QuickStart Guide, Data Binding chapter.

                Comment

                Working...
                X