Announcement

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

  • mathias
    replied
    Yeah, it was copy paste error. real code:

    Code:
            if(ledgerEmailOnly != null){
                if(ledgerId.getValue() != null && mainC.getValueAsBoolean()){
                    ledgerEmailOnly.show();
                }else{
                    ledgerEmailOnly.hide();
                }
            }

    Leave a comment:


  • Blama
    replied
    Sorry, I meant that your sample code in #3 is the same as in #1 (most likely c&p error).
    Regarding your issue in #5. As you wrote before best create another testcase for it.

    Best regards
    Blama

    Leave a comment:


  • mathias
    replied
    It's pretty easy to reproduce - i have made a similar example to the one above, but substituted the booleanitem to a custom canvasitem.

    Leave a comment:


  • mathias
    replied
    No, that one is different, i use show/hide there, and it only happens in Firefox.

    Basically, if i have a canvasitem somewhere in the form, and do show/hide on it based on some value in a field, it sometimes shows or hides all fields after it in the form, and sometimes all fields in the form. Haven't figured out what makes the behavior slightly different, but it happens.

    Leave a comment:


  • Blama
    replied
    Hi mathias,

    that code does the same as your initial code?!

    Best regards
    Blama

    Leave a comment:


  • mathias
    replied
    Hey Blama,

    if i changed the code to
    Code:
    if(name.getValue().equals("Japan")){
                        member.setVisible(true);
                    }else{
                        member.setVisible(false);
                    }
    It works! Thanks, nice catch.

    I have another issue, where showing/hiding a canvasitem with a MapWidget hides all items in the form, will post that in a separate thread. That one is hairier though...

    Leave a comment:


  • Blama
    replied
    Hi mathias,

    please try using member.show() / hide() in the event handler. setVisible() is only pre-draw (see the docs).

    I just wanted to add "same for setDisabled() / disable() / enable()", but that is not true.
    Isomorphic: Shoudn't the behavior be similar here?

    Best regards
    Blama

    Leave a comment:


  • mathias
    started a topic Bug in dynamicform - booleanitem

    Bug in dynamicform - booleanitem

    I have a dynamicform, where i have a booleanitem i only wish to display depending on values in another field.

    I have discovered, that if you set the booleanitem to not visible when you create the form, and later set it to visible, it does not get its own row in the form! Instead, it appears on the same row as the previous formitem, to the right.
    I also discovered that if you set it to disabled/enabled, it pops back into place. (This is why i included the "Edit button" in the test, to show what i mean)Very strange.

    I have created a simple reproducible example based on your "Grid-Form Binding - Update" example. See below. It would be great if you could investigate asap.

    5.0-p20160409

    Code:
    public class Test implements EntryPoint {
    
        VLayout mainLayout;
    
        BooleanItem member;
        TextItem name;
    
        public void onModuleLoad() {
            initLayout();
            final ListGrid grid = new ListGrid();
            grid.setWidth(500);
            grid.setHeight(224);
            grid.setShowAllRecords(true);
    
            ListGridField countryCodeField = new ListGridField("countryCode", "Code", 40);
            ListGridField nameField = new ListGridField("countryName", "Country");
            ListGridField independenceField = new ListGridField("independence", "Nationhood", 225);
            independenceField.setType(ListGridFieldType.DATE);
            ListGridField populationField = new ListGridField("population", "Population");
            populationField.setType(ListGridFieldType.INTEGER);
            ListGridField gdpField = new ListGridField("gdp", "GDP ($B)");
            gdpField.setType(ListGridFieldType.FLOAT);
    
            grid.setFields(new ListGridField[]{countryCodeField, nameField, independenceField,
                populationField, gdpField});
            grid.setCanResizeFields(true);
            grid.setData(CountrySampleData.getRecords());
    
            name = new TextItem("countryName", "Country");
            //name.setCanEdit(false);
            FormItem pop = new TextItem("population", "Population");
            member = new BooleanItem("member_g8", "Member G8");
            member.setVisible(false);
            //member.setCanEdit(false);
    
            final DynamicForm form = new DynamicForm(){
                public void editRecord(Record record) {
                    super.editRecord(record);
    
                }
            };
            form.setFields(name, pop, member);
            grid.addRecordClickHandler(new RecordClickHandler() {
                public void onRecordClick(RecordClickEvent event) {
                    form.reset();
                    form.editSelectedData(grid);
                    member.setVisible(name.getValue().equals("Japan"));
                }
            });
    
            mainLayout.addMember(grid);
            mainLayout.addMember(form);
            grid.draw();
    
            final IButton button = new IButton();
            button.setTitle("Edit");
    
            button.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent clickEvent) {
                    if(button.getTitle().equals("Edit")){
                        form.editRecord(grid.getSelectedRecord());
                        button.setTitle("Cancel");
                        member.setCanEdit(true);
                    }else{
                        form.cancelEditing();
                        button.setTitle("Edit");
                        member.setCanEdit(false);
                    }
    
    
                }
            });
            mainLayout.addMember(button);
        }
    
        public void initLayout(){
            try {
                mainLayout = new VLayout();
                //mainLayout.setAlign(VerticalAlignment.TOP);
                mainLayout.setMembersMargin(20);
                mainLayout.setBackgroundImage("bg.png");
                mainLayout.setWidth(900);
                mainLayout.setHeight100();
    
                HLayout centering = new HLayout();
                centering.setWidth100();
                centering.setHeight100();
                centering.setAlign(Alignment.CENTER);
    
                centering.addMember(createEmptyFullHeightCanvas());
                centering.addMember(mainLayout);
                centering.addMember(createEmptyFullHeightCanvas());
    
                RootPanel.get().add(centering);
                centering.redraw();
            } catch (Exception e) {
                e.printStackTrace(); 
            }
        }
    
        public Canvas createEmptyFullHeightCanvas() {
            Canvas canvas = new Canvas();
            canvas.setWidth("*");
            return canvas;
        }
    
    }
    Last edited by mathias; 25 Apr 2016, 00:31.
Working...
X