Announcement

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

  • Isomorphic
    replied
    Thanks, we'll take another look today.

    Leave a comment:


  • Blama
    replied
    Hi Isomorphic,

    this is the whole code needed (retested with v11.1p_2018-01-29):

    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.data.DataSource;
    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.form.fields.ComboBoxItem;
    import com.smartgwt.client.widgets.form.fields.SelectItem;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class BuiltInDS implements EntryPoint {
        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();
                }
            });
    
            VLayout mainLayout = new VLayout(20);
            mainLayout.setWidth100();
            mainLayout.setHeight100();
    
            IButton recreateBtn = new IButton("Recreate SelectItem", new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    recreate(true);
                }
            });
            recreateBtn.setWidth(200);
    
            IButton recreateBtn2 = new IButton("Recreate ComboBoxItem", new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    recreate(false);
                }
            });
            recreateBtn2.setWidth(200);
    
            mainLayout.addMembers(recreateBtn, recreateBtn2);
    
            recreate(false);
            mainLayout.draw();
    
        }
    
        private void recreate(boolean asSelectItem) {
            Window w = new Window();
            w.setWidth("20%");
            w.setHeight("20%");
            w.setMembersMargin(0);
            w.setModalMaskOpacity(70);
            w.setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")");
            w.setTitle("SelectItem/ComboBoxItem problems with missing fetchRemoteDataReply" + w.getTitle());
            w.setShowMinimizeButton(false);
            w.setIsModal(true);
            w.setShowModalMask(true);
            w.centerInPage();
    
            final ListGrid lg = new ListGrid();
            lg.setDataSource(DataSource.get("RESELLER"));
            lg.setCanEdit(true);
    
            ListGridField companyIdLGF = new ListGridField("COMPANY_ID", asSelectItem ? "As SelectItem" : "As ComboBoxItem");
    
            if (asSelectItem) {
                SelectItem si = new SelectItem("ID");
                si.setCachePickListResults(false);
                si.setOptionDataSource(DataSource.get("COMPANY"));
                si.setValueField("ID");
                si.setForeignDisplayField("NAMETWICE");
                si.setSortField("NAMETWICE");
                companyIdLGF.setEditorProperties(si);
            } else {
                ComboBoxItem cbi = new ComboBoxItem("ID");
                cbi.setCachePickListResults(false);
                cbi.setOptionDataSource(DataSource.get("COMPANY"));
                cbi.setValueField("ID");
                cbi.setForeignDisplayField("NAMETWICE");
                cbi.setSortField("NAMETWICE");
                companyIdLGF.setEditorProperties(cbi);
            }
    
            ListGridField nameLGF = new ListGridField("NAME");
    
            lg.setFields(companyIdLGF, nameLGF);
            lg.fetchData();
            w.addItem(lg);
            w.show();
        }
    }
    RESELLER.ds.xml (add in BuiltInDS.html):
    Code:
    <DataSource ID="RESELLER" serverType="sql" tableName="RESELLER">
        <fields>
            <field name="ID" type="integer" primaryKey="true" required="true" />
            <field foreignKey="COMPANY.ID" displayField="COMPANY_NAME" name="COMPANY_ID" type="integer" />
            <field name="COMPANY_NAME" includeFrom="COMPANY.NAME" />
            <field name="NAME" type="text" />
        </fields>
    </DataSource>
    COMPANY.ds.xml (add in BuiltInDS.html):
    Code:
    <DataSource ID="COMPANY" serverType="sql" tableName="COMPANY">
        <fields>
            <field name="ID" type="integer" primaryKey="true" required="true" />
            <field name="NAME" type="text" />
            <field name="NAMETWICE" customSelectExpression="COMPANY.NAME||COMPANY.NAME" />
        </fields>
    </DataSource>
    Oracle DDL (also add ojdbc6.jar to project):
    Code:
    DROP TABLE reseller;
    DROP TABLE company;
    
    CREATE TABLE company (
        id          INTEGER NOT NULL,
        name        VARCHAR2(20),
        CONSTRAINT company_pk PRIMARY KEY ( id ) ENABLE
    );
    
    CREATE TABLE reseller (
        id           INTEGER NOT NULL,
        company_id   INTEGER,
        name         VARCHAR2(20),
        CONSTRAINT reseller_pk PRIMARY KEY ( id ),
        CONSTRAINT reseller_fk1 FOREIGN KEY ( company_id )
            REFERENCES company ( id )
        ENABLE
    );
    
    INSERT INTO company (ID,NAME)
    SELECT level, 'Company ' || to_char(level, '000') FROM dual connect by level<=400;
    
    INSERT INTO reseller (ID,company_id,NAME) VALUES (1,1,'Reseller 1');
    INSERT INTO reseller (ID,company_id,NAME) VALUES (2,100,'Reseller 2');
    INSERT INTO reseller (ID,company_id,NAME) VALUES (3,400,'Reseller 3');
    COMMIT;
    Please see this ComboBoxItem video:
    Click image for larger version

Name:	Missing fetchRemoteDataReply 1.gif
Views:	316
Size:	48.7 KB
ID:	251550
    I'd expect to see "Company 400Company 400" after the double click (-> as the ComboBoxItem only requests the first 75 rows for the pickList, this has to come from a (missing) fetchMissingValueReply-request).
    This happens the same for SelectItems:
    Click image for larger version

Name:	Missing fetchRemoteDataReply 3.gif
Views:	230
Size:	41.9 KB
ID:	251552


    Additional related(?) problem (ComboBoxItem only, just noticed) only with Company 001 (not with Company 400), if you show the pickList and do not select anything and hide it and then exit the editor (always reload the sample with F5 before, does only happen the 1st time):
    Click image for larger version

Name:	Missing fetchRemoteDataReply 2.gif
Views:	257
Size:	74.4 KB
ID:	251551

    Best regards
    Blama

    Leave a comment:


  • Isomorphic
    replied
    Can you post the broken code again? We've tried based on your original code, and see no issues - but it's become a bit confused with various changes to various bits of the original sample, combined with cross-linking posts.

    Leave a comment:


  • Isomorphic
    replied
    Apologies, this one slipped through - we'll take a look today.

    Leave a comment:


  • Blama
    replied
    Hi Isomorphic,

    could you reproduce this one? It's a bad one IMHO.

    Best regards
    Blama

    Leave a comment:


  • Blama
    replied
    Hi Isomorphic,

    as this touches the same area as the linked thread in #1, this also happens with this code:
    Code:
            if (asSelectItem) {
                SelectItem si = new SelectItem("ID");
                si.setCachePickListResults(false);
                si.setOptionDataSource(DataSource.get("COMPANY"));
                si.setValueField("ID");
                si.set[B]Foreign[/B]DisplayField("NAMETWICE");
                si.setSortField("NAMETWICE");
                companyIdLGF.setEditorProperties(si);
            } else {
                ComboBoxItem cbi = new ComboBoxItem("ID");
                cbi.setCachePickListResults(false);
                cbi.setOptionDataSource(DataSource.get("COMPANY"));
                cbi.setValueField("ID");
                cbi.set[B]Foreign[/B]DisplayField("NAMETWICE");
                cbi.setSortField("NAMETWICE");
                companyIdLGF.setEditorProperties(cbi);
            }
    Best regards
    Blama

    Leave a comment:


  • Blama
    replied
    Hi Isomorphic,

    OK, this does also happen for SelectItems when the needed data is not in the first 75 rows for the pickList fetchRemoteDataReply (still v11.1p_2018-01-18).

    Please see this change to the testcase:
    Code:
            if (asSelectItem) {
                SelectItem si = new SelectItem("ID");
                si.setCachePickListResults(false);
                si.setOptionDataSource(DataSource.get("COMPANY"));
                si.setValueField("ID");
                si.setDisplayField("[B]NAMETWICE[/B]");
    [B]si.setSortField("NAMETWICE");[/B]
                companyIdLGF.setEditorProperties(si);
            } else {
                ComboBoxItem cbi = new ComboBoxItem("ID");
                cbi.setCachePickListResults(false);
                cbi.setOptionDataSource(DataSource.get("COMPANY"));
                cbi.setValueField("ID");
                cbi.setDisplayField("[B]NAMETWICE[/B]");
    [B]cbi.setSortField("NAMETWICE");[/B]
                companyIdLGF.setEditorProperties(cbi);
            }
    Data generation DML change:
    Code:
    [B]INSERT INTO company (ID,NAME)
    SELECT level, 'Company ' || to_char(level, '000') FROM dual connect by level<=400;[/B]
    
    INSERT INTO reseller (ID,company_id,NAME) VALUES (1,1,'Reseller 1');
    INSERT INTO reseller (ID,company_id,NAME) VALUES (2,[B]100[/B],'Reseller 2');
    INSERT INTO reseller (ID,company_id,NAME) VALUES (3,[B]400[/B],'Reseller 3');
    Best regards
    Blama

    Leave a comment:


  • ComboBoxItem issue with missing fetchMissingValueReply (when used as ListGrid editor only?)

    Hi Isomorphic,

    creating this testcase I noticed there is an issue with ComboBoxItems used as editor in ListGridFields. It seems in that case they don't fire the necessary fetchMissingValueReply needed for the displayField. This is not true for SelectItems (on open fetchRemoteDataReply to load the pickList rows 0-75) and also works in normal DynamicForms where there is the fetchMissingValueReply-request.
    I can also reproduce the issue in my application, but as I'm not having that setting often, I did not notice this, yet.

    Please see this video (v11.1p_2018-01-18):
    Click image for larger version

Name:	ComboBoxItem problem with missing fetchMissingValuesReply.gif
Views:	388
Size:	100.4 KB
ID:	251398
    Until you open the pickList, the displayField value is missing for all rows, after you opened the pickList once, it is present for all rows.

    (I did not test what happens if the fetchRemoteDataReply if either the ComboBoxItem or the SelectItem does not include the needed row, yet, but will do so next.)


    Change to the linked testcase:
    Code:
            if (asSelectItem) {
                SelectItem si = new SelectItem("ID");
                si.setCachePickListResults(false);
                si.setOptionDataSource(DataSource.get("COMPANY"));
                si.setValueField("ID");
                si.setDisplayField("[B]NAMETWICE[/B]");
                companyIdLGF.setEditorProperties(si);
            } else {
                ComboBoxItem cbi = new ComboBoxItem("ID");
                cbi.setCachePickListResults(false);
                cbi.setOptionDataSource(DataSource.get("COMPANY"));
                cbi.setValueField("ID");
                cbi.setDisplayField("[B]NAMETWICE[/B]");
                companyIdLGF.setEditorProperties(cbi);
            }
    Best regards
    Blama
Working...
X