Announcement

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

    displayField is not applied

    Hi Isomorphic,

    please take a look at this test case.
    Version: v12.0p_2019-11-13/PowerEdition Deployment (built 2019-11-13)

    animals.ds.xml
    Code:
    <DataSource
        ID="animals"
        serverType="sql"
        tableName="animals"
        testFileName="animals.data.xml"
    >
        <fields>
            <field name="commonName"      title="Animal"             type="text"/>
            <field name="scientificName"  title="Scientific Name"    type="text"  primaryKey="true"  required="true"/>
            <field name="lifeSpan"        title="Life Span"          type="integer"/>
            <field name="status"          title="Endangered Status"  type="text">
                <valueMap>
                    <value>Threatened</value>
                    <value>Endangered</value>
                    <value>Not Endangered</value>
                    <value>Not currently listed</value>
                    <value>May become threatened</value>
                    <value>Protected</value>
                </valueMap>
            </field>
            <field name="diet"            title="Diet"               type="text"/>
            <field name="testField" type="text" customSelectExpression="diet" displayField="test2Field" />
            <field name="testField2" type="text" customSelectExpression="information" />
            <field name="information"     title="Interesting Facts"  type="text"  length="1000"/>
            <field name="picture"         title="Picture"            type="image" detail="true"
                   imageURLPrefix="/isomorphic/system/reference/inlineExamples/tiles/images/"/>
        </fields>
    
            <operationBinding operationType="fetch">
                <!-- <tableClause>inner join animals a on a.commonName = commonName</tableClause> -->
            </operationBinding>
    </DataSource>
    BuiltInDS.java
    Code:
    package com.smartgwt.sample.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.Version;
    import com.smartgwt.client.core.KeyIdentifier;
    import com.smartgwt.client.util.Page;
    import com.smartgwt.client.util.PageKeyHandler;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.IButton;
    import com.smartgwt.client.widgets.Window;
    import com.smartgwt.client.widgets.events.ClickEvent;
    import com.smartgwt.client.widgets.events.ClickHandler;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class BuiltInDS extends VLayout implements EntryPoint {
        private IButton recreateBtn;
    
        public void onModuleLoad() {
            KeyIdentifier debugKey = new KeyIdentifier();
            debugKey.setCtrlKey(true);
            debugKey.setKeyName("D");
    
            Page.registerKey(debugKey, new PageKeyHandler() {
                public void execute(String keyName) {
                    SC.showConsole();
                }
            });
    
            setWidth100();
            setHeight100();
    
            recreateBtn = new IButton("Recreate");
            recreateBtn.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    new MyWindow().show();
                }
            });
            addMember(recreateBtn);
            new MyWindow().show();
            draw();
        }
    
        private class MyWindow extends Window {
            public MyWindow() {
                setWidth(600);
                setHeight(300);
                setMembersMargin(0);
                setModalMaskOpacity(70);
                setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")");
                setTitle("img- vs object-tag issue" + getTitle());
                setShowMinimizeButton(false);
                setIsModal(true);
                setShowModalMask(true);
                centerInPage();
    
                ListGrid lg = new ListGrid();
                lg.setDataSource("animals");
    
                ListGridField diet = new ListGridField("diet");
                ListGridField testField = new ListGridField("testField");
                testField.setTitle("Display field: information");
                ListGridField information = new ListGridField("information");
    
                lg.setFields(diet, testField, information);
    
                lg.fetchData();
    
                addItem(lg);
            }
        }
    }
    Display field of "testField" should be "information".

    Best regards
    Pavo

    #2
    You configured the displayField to be "test2Field" but you named the field "testField2".

    Comment


      #3
      Hi Isomorphic,

      sorry, my fault. Now you should be able to see the problem. This could be related to 12.0p Join generation change between March version and current nightly

      Code:
      <DataSource
          ID="animals"
          serverType="sql"
          tableName="animals"
          testFileName="animals.data.xml"
      >
          <fields>
              <field name="commonName"      title="Animal"             type="text"/>
              <field name="scientificName"  title="Scientific Name"    type="text"  primaryKey="true"  required="true"/>
              <field name="lifeSpan"        title="Life Span"          type="integer"/>
              <field name="status"          title="Endangered Status"  type="text">
                  <valueMap>
                      <value>Threatened</value>
                      <value>Endangered</value>
                      <value>Not Endangered</value>
                      <value>Not currently listed</value>
                      <value>May become threatened</value>
                      <value>Protected</value>
                  </valueMap>
              </field>
              <field name="diet"            title="Diet"               type="text" />
              <field name="testField" type="text" customSelectExpression="diet" displayField="test2Field" />
              <field name="test2Field" type="text" includeFrom="a.information" />
              <field name="information"     title="Interesting Facts"  type="text"  length="1000" />
              <field name="picture"         title="Picture"            type="image" detail="true"
                     imageURLPrefix="/isomorphic/system/reference/inlineExamples/tiles/images/" />
          </fields>
      
              <operationBinding operationType="fetch">
                   <tableClause>animals inner join animals a on a.commonName = commonName</tableClause> 
              </operationBinding>
      </DataSource>
      Best regards
      Pavo

      Comment


        #4
        If the problem is simply that you are seeing the field test2Field not populated because of a change in join generation, then please just watch the other thread.

        If there is a separate problem where the field is populated but is not appearing when configured as a displayField, let us know on this thread.

        Comment


          #5
          Hi Isomorphic,

          this is a separate problem, but that fix could also fix this problem, but maybe not! Because with March version of smartGWT this works fine.

          If you want to see this problem:
          • Please take a "BuiltInDS.java" from post #1 and "animals.ds.xml" from #3 post.
          • Display field of ListGridField "testField" should be "information" and not "diet".

          Best regards
          Pavo

          Comment


            #6
            Hi Isomorphic,

            I can confirm that this fix 12.0p Join generation change between March version and current nightly has been fix this problem as well.

            Best regards
            Pavo

            Comment

            Working...
            X