Announcement

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

    DynamicForm SelectItem fetches pickList data even though the form itself is not editable

    Hi Isomorphic,

    please see this BuiltInDS based testcase (v12.0p_2018-12-13) where on start there are two fetches, while I'd only expect one:

    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.AdvancedCriteria;
    import com.smartgwt.client.data.Criterion;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.types.OperatorId;
    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.DynamicForm;
    import com.smartgwt.client.widgets.form.fields.FormItem;
    import com.smartgwt.client.widgets.form.fields.SelectItem;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class BuiltInDS implements EntryPoint {
        private VLayout mainLayout;
        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();
                }
            });
    
            mainLayout = new VLayout(20);
            mainLayout.setWidth100();
            mainLayout.setHeight100();
    
            recreateBtn = new IButton("Recreate");
            recreateBtn.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    recreate();
                }
            });
            mainLayout.addMember(recreateBtn);
            recreate();
            mainLayout.draw();
        }
    
        private void recreate() {
            Window w = new Window();
            w.setWidth("25%");
            w.setHeight("45%");
            w.setMembersMargin(0);
            w.setModalMaskOpacity(70);
            w.setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")");
            w.setTitle("DynamicForm SelectItem fetches pickList data even though the form itself is not editable" + w.getTitle());
            w.setShowMinimizeButton(false);
            w.setIsModal(true);
            w.setShowModalMask(true);
            w.centerInPage();
    
            final DynamicForm supplyItemForm = new DynamicForm();
            supplyItemForm.setCanEdit(false);
            supplyItemForm.setDataSource(DataSource.get("supplyItem"));
            supplyItemForm.setHeight100();
            supplyItemForm.setWidth100();
            supplyItemForm.setAutoFetchData(false);
    
            FormItem itemID = new FormItem("itemID");
            SelectItem itemName = new SelectItem("itemName");
            FormItem sku = new FormItem("SKU");
            sku.setEditorProperties(new FormItem());
            FormItem category = new FormItem("category");
    
            supplyItemForm.setFields(itemID, itemName, sku, category);
            supplyItemForm.fetchData(new AdvancedCriteria(new Criterion(sku.getName(), OperatorId.EQUALS, "58074604")));
            w.addItem(supplyItemForm);
            w.show();
        }
    }
    Click image for larger version  Name:	2 fetches.PNG Views:	1 Size:	20.4 KB ID:	256233

    Best regards
    Blama
    Last edited by Blama; 20 Dec 2018, 03:26. Reason: Added version v12.0p_2018-12-13

    #2
    Short addition: This does also happen with
    Code:
    supplyItemForm.setReadOnlyDisplay(ReadOnlyDisplayAppearance.STATIC);
    where there even isn't a SelectItem drawn.

    Best regards
    Blama

    Comment


      #3
      This one's been fixed for builds dated December 25 and later.

      Comment


        #4
        Hi Isomorphic,

        I can see this one is fixed using v12.0p_2019-01-05.

        Thank you & Best regards
        Blama

        Comment


          #5
          Also, when adding

          Code:
                  w.addItem(new IButton("toggleRW", new ClickHandler() {
                      @Override
                      public void onClick(ClickEvent event) {
                          supplyItemForm.setCanEdit(!supplyItemForm.getCanEdit());
                      }
                  }));
          the pickList fetch is happening as expected on 1st activation.

          Best regards
          Blama

          Comment

          Working...
          X