Announcement

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

    Alignment of Boolean field in SelectItem pickList

    Hi Isomorphic,

    please see the attached BuiltInDS-based testcase (v10.1p_2017-08-22). As you can see, the inStock-CheckBox is centered by default in the ListGrid (good), but it is not in the SelectItem-pickList.
    One can archive this by setting inStockLGF.setAlign(Alignment.CENTER), but in my opinion this should by done automatically.

    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.DataSource;
    import com.smartgwt.client.types.Alignment;
    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.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 {
        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("95%");
            w.setHeight("95%");
            w.setMembersMargin(0);
            w.setModalMaskOpacity(70);
            w.setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")");
            w.setTitle("Alignment in SelectItem-pickList" + w.getTitle());
            w.setShowMinimizeButton(false);
            w.setIsModal(true);
            w.setShowModalMask(true);
            w.centerInPage();
    
            {
                final ListGrid supplyItemLG = new ListGrid(DataSource.get("supplyItem"));
                supplyItemLG.fetchData(new AdvancedCriteria("SKU", OperatorId.STARTS_WITH, "11"));
                w.addItem(supplyItemLG);
            }
    
            {
                final DynamicForm supplyItemDF = new DynamicForm();
    
                SelectItem test = new SelectItem("TEST");
                test.setOptionDataSource(DataSource.get("supplyItem"));
                ListGridField skuLGF = new ListGridField("SKU");
                ListGridField itemNameLGF = new ListGridField("itemName");
                ListGridField categoryLGF = new ListGridField("category");
                ListGridField unitsLGF = new ListGridField("units");
                ListGridField unitCostLGF = new ListGridField("unitCost");
                ListGridField inStockLGF = new ListGridField("inStock");
                // inStockLGF.setAlign(Alignment.CENTER); // This fixes it.
    
                test.setPickListFields(skuLGF, itemNameLGF, categoryLGF, unitsLGF, unitCostLGF, inStockLGF);
                test.setPickListWidth(500);
    
                supplyItemDF.setFields(test);
                w.addItem(supplyItemDF);
            }
    
            w.show();
        }
    }
    Click image for larger version

Name:	CheckBox-placement.PNG
Views:	72
Size:	6.6 KB
ID:	248938

    Best regards
    Blama

    #2
    Hi Isomorphic,

    this is still current using v11.1p_2017-12-29.

    Best regards
    Blama

    Comment

    Working...
    X