Announcement

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

    Separation of number values when using optionDataSource in Selectitem on IE

    Using 2.5.2011-05-08-EVAL and
    A DataSource definition file with a
    DataSourceField definition which uses an optionDataSource
    where code and name are defined as DataSourceFields to be
    displayed dynamically in a SelectItem as options

    When the user selects values like 0, 1, 2, 3 from the pickers inside of the selectItem,the value will be inserted in the textfield of the selectitem.
    But the inserted value differs on Firefox and IE:

    on Firefox it will display the numbers 0, 1, 2, 3 - thats fine.
    on IE 8, there will be displayed 0.00 , 1.00, 2.00, 3.00 - why ?

    Using it with a clientOnly DataSource ( without an optionDataSource and static valueMap), this problem doesn't appeares.

    Changing the types of the fields in the optionDataSource from integer to text has no effect.

    We are using Oracle 10 db.

    Do you have any idea, from where this difference in Firefox and IE come? Seems like it is related to the usage of optionDataSource.

    Code:
     ListGridField code = new ListGridField("code");
            code.setWidth(40);
            ListGridField name = new ListGridField("name");
            name.setWidth(300);
    
      SelectItem item = new SelectItem("integer");
            item.setPickListFields(code, name);
            item.setPickListWidth(400);
            item.setPickListHeaderHeight(0);
            item.setAllowEmptyValue(false);
            item.setMultiple(true);
            LinkedHashMap<String, Integer> map = new LinkedHashMap();
            map.put("0", 0);
            map.put("1", 1);
            map.put("300", 300);
            item.setValueMap(map);
            testForm.setItems(item);

    #2
    Can you show the data coming back from the server, from the RPC tab, for each browser?

    Comment


      #3
      It looks like:

      [
      {
      endRow:76,
      queueStatus:0,
      totalRows:250,
      isDSResponse:true,
      invalidateCache:false,
      status:0,
      startRow:0,
      data:[
      {
      id:1,
      name:"first code",
      MYROWNUM:1,
      code:0
      },
      {
      id:2,
      name:"second code",
      MYROWNUM:2,
      code:2
      },
      {
      id:3,
      name:"third code",
      MYROWNUM:3,
      code:3
      },
      and so on

      Comment


        #4
        Is the data the same for both browsers? Because this code and this data doesn't reproduce the problem if you just drop in the SDK.

        Comment


          #5
          Hi all,

          SmartGWT version: 2.5.2011-05-30-PE.
          Internet Explorer 8.0.6001.18702. Bug doesn't occur in Firefox.

          Reproduced this problem with "employees" data from sample "build-in-ds":
          Code:
          import com.google.gwt.core.client.EntryPoint;
          import com.smartgwt.client.data.DataSource;
          import com.smartgwt.client.widgets.Canvas;
          import com.smartgwt.client.widgets.form.DynamicForm;
          import com.smartgwt.client.widgets.form.fields.SelectItem;
          import com.smartgwt.client.widgets.layout.VLayout;
          
          public class SelectItemEP implements EntryPoint {
              private DynamicForm form;
          
              public Canvas getViewPanel() {
                  form = new DynamicForm();
          
                  SelectItem item = new SelectItem();
                  item.setOptionDataSource(DataSource.get("employees"));
                  item.setValueField("EmployeeId");
                  item.setMultiple(true);
                  
                  form.setFields(item);
          
                  VLayout layout = new VLayout();
                  layout.addMember(form);
          
                  return layout;
              }
          
              @Override
              public void onModuleLoad() {
                  getViewPanel().draw();
          
              }
          }
          Greetz,
          Alexey

          Comment


            #6
            This happens because there's no type set on the field (the SelectItem) and the form isn't bound to a DataSource to provide a type for the field either, so just make sure you're declaring the appropriate type.

            The fact that the formatting differs in the absence of a type is more of a curiosity than a bug as such, but we'll file it regardless.

            Comment


              #7
              ok, providing the type 'integer' for SelectItem either in Java or in DataSource solved this problem, but then I have questions:

              1. Why it's not enough to have provided 'integer' field type in option datasource (in my example this is 'EmployeeId' field)?

              2. For what is actually type 'select' in DataSources?

              3. After setting type 'integer' to SelectItem it's not possible any longer to have some default text as empty value. Please see the wanted behavior on provided screenshots. How can I achieve this?

              Greetz,
              Alexey
              Attached Files

              Comment


                #8
                1. Because these are two separate fields being declared in two DataSources

                2. That is not a valid type setting

                3. Consider showHintInField and emptyDisplayValue as possible approaches

                Comment


                  #9
                  To 1. & 2. - thx!
                  To 3.: problem still remains the same. item.setEmptyDisplayValue("All") doesn't work together with item.setType(FieldType.INTEGER.getValue()). I have no idea how to use showHintInField to solve my problem.
                  Please extend my example in order to achieve the result which you can see at my screenshots.

                  Regards,
                  Alexey

                  Comment


                    #10
                    You need to remove your call to setAllowEmptyValue(false) or the emptyDisplayValue will not be used.

                    Comment


                      #11
                      Of course I did this already, the problem is now in item.setType(FieldType.INTEGER.getValue()) - this prevents displaying "All" as empty display value.

                      Code:
                      import com.google.gwt.core.client.EntryPoint;
                      import com.smartgwt.client.data.DataSource;
                      import com.smartgwt.client.types.FieldType;
                      import com.smartgwt.client.widgets.Canvas;
                      import com.smartgwt.client.widgets.form.DynamicForm;
                      import com.smartgwt.client.widgets.form.fields.SelectItem;
                      import com.smartgwt.client.widgets.layout.VLayout;
                      
                      public class SelectItemEP implements EntryPoint {
                          private DynamicForm form;
                      
                          public Canvas getViewPanel() {
                              form = new DynamicForm();
                      
                              SelectItem item = new SelectItem();
                              item.setType(FieldType.INTEGER.getValue());
                              item.setOptionDataSource(DataSource.get("employees"));
                              item.setValueField("EmployeeId");
                              item.setMultiple(true);
                              item.setEmptyDisplayValue("All");
                              
                              form.setFields(item);
                      
                              VLayout layout = new VLayout();
                              layout.addMember(form);
                      
                              return layout;
                          }
                      
                          @Override
                          public void onModuleLoad() {
                              getViewPanel().draw();
                      
                          }
                      }

                      Comment


                        #12
                        I'm still waiting for the answer.
                        thx in advance.

                        Alexey

                        Comment


                          #13
                          We had the same bug and only in IE. The data sent back to the server was also 1.00, 2.00 instead of 1,2 .

                          Comment


                            #14
                            We've fixed this, please take a look at the next nightly...

                            Comment

                            Working...
                            X