Announcement

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

    The header in the dropdown list does not come if we use single column

    Hi,

    I'm using the nightly build on 23 Feb.
    If I specify more than 1 column in setPickListFields then I can the header in the drop down (SelectItem).
    However, if I set only one column then the value in the combo does arrive, however it does not have any header.

    Please help me if there are any other configurations need to be done
    or is it currently not possible?

    #2
    Please show a test case demonstrating a problem.

    Comment


      #3
      RE : The header in the dropdown list does not come if we use single column

      Hi,

      I'm using the server side datasource as follows,

      Code:
      <DataSource
          ID="flowRateDataSource"   
          serverConstructor="com.sungard.gwt.datasource.ComboBoxDataSource"
          objectName="operations/NominationPlanSearchAPI"
          methodName="findFlowRates"
          translateCols=""
          formatCols=""
          >
          <fields>
              <field name="FREQUENCYDETAIL_ID"  editorType="" title="frequency detail Id"   type="integer"  primaryKey="true"/>
              <field name="NAME"    type="text"     title="Flowrate"    length="128"       required="true"/>       
          </fields>
      </DataSource>
      The APIEJB returns me the id and name of the flow rate.
      The ComboBoxDataSource parse the request calls the API and returns the response.

      Following is my client-side code
      Code:
              ListGridField itemField = new ListGridField("NAME");  
              ListGridField unitsField = new ListGridField("FREQUENCYDETAIL_ID");  
      		
              SelectItem item2 = new SelectItem("FREQUENCYDETAIL_ID");
              item2.setWidth(240);
              item2.setTitle("Nomination");  
              item2.setOptionDataSource(DataSource.getDataSource("flowRateDataSource"));  
              item2.setValueField("FREQUENCYDETAIL_ID");  
              item2.setDisplayField("NAME");  
              item2.setPickListWidth(450);  
              item2.setPickListFields(itemField, unitsField);
              item2.setAutoFetchData(true);
      
              final DynamicForm form = new DynamicForm();  
              form.setItems(item2);  
              form.draw();
      If I run the above code I can see the the Combo as per image1. If I don't add unitsField in the combo then I see combo as per image2.
      Attached Files

      Comment


        #4
        RE : The header in the dropdown list does not come if we use single column

        Sombody please help me.

        Comment


          #5
          It's "by design", I think. Look at the java docs to the SelectItem setPickListFields() method:

          setPickListFields

          public void setPickListFields(ListGridField... pickListFields)

          This property allows the developer to specify which field[s] will be displayed in the drop down list of options.

          Only applies to databound pickLists (see optionDataSource, or picklists with custom data set up via the advanced PickList.getClientPickListData() method.

          If this property is unset, we display the displayField, if specified, otherwise the valueField

          If there are multiple fields, column headers will be shown for each field, the height of which can be customized via the pickListHeaderHeight attribute.

          Each field to display should be specified as a ListGridField object. Note that unlike in ListGrid, dataSource fields marked as com.smartgwt.client.data.DataSourceField#setDis${isc.DocUtils.linkForRef('DataSourceField.display','display:true')} will not be hidden by default in pickLists. To override this behavior, ensure that you specify an explicit value for {@link com.smartgwt.client.widgets.grid.ListGridField#getShowIf showIf}

          Note : This is an advanced setting

          Parameters:
          pickListFields - pickListFields Default value is null

          MichalG

          Comment


            #6
            RE : The header in the dropdown list does not come if we use single column

            Hi Michalg,

            Thanks for the reply. However, in my 2nd scenario I do set the pickListFields
            property. There instead of mulitple columns I do set a single column.
            In this case I want the column header which is not coming.

            Comment


              #7
              It does not matter that you do set the pickListFields.
              What matters is that you have single column in the drop down list.
              This is my understanding of statement:
              "If there are multiple fields, column headers will be shown for each field,..."
              MichalG

              Comment


                #8
                Michalg is correct - it's by design, as showing a header when there's only one field is redundant and wastes screen space. That said, the header can be forced on by calling SelectItem/ComboBoxItem.setAttribute("pickListProperties", obj) where obj is a JavaScriptObject with one property "showHeader" with value true.

                Comment


                  #9
                  RE : The header in the dropdown list does not come if we use single column

                  Could you please give me a piece of code where in I can set property to the JavaScriptObject?

                  Comment


                    #10
                    Code:
                    JavaScriptObject jso = JSOHelper.createObject();
                    JSOHelper.setAttribute(jso, "showHeader", true);
                    selectItem.setAttribute("pickListProperties", jso);
                    Probably that way. Unfortunately it does not force header for me.
                    MichalG

                    Comment


                      #11
                      RE : The header in the dropdown list does not come if we use single column

                      Neither for me.

                      Can anybody tell me how to enforce the header when there is a single column in the datasource to map the ComboBoxItem?

                      Comment


                        #12
                        Hi,

                        I am facing the same issue. Any help?

                        Comment


                          #13
                          Simply call setPickListProperties with showHeader:true.

                          Comment

                          Working...
                          X