Announcement

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

  • mathias
    replied
    Bumping this in hope that someone has time to give me some insight.

    Leave a comment:


  • mathias
    replied
    Ok, thanks anyway. Iso, any idea how i go about adding an additional clickhandler to the "Apply" button of a DateChooser for a DateTimeFormItem? I'm out of ideas.

    Leave a comment:


  • Blama
    replied
    Hi mathias,

    sorry, no idea how to get the "default" AutoChild in order to modify it and send it back via setAutoChildProperties.

    Best regards
    Blama

    Leave a comment:


  • mathias
    replied
    Hey Blama. Yeah with AutoChild did manage to get something to happen. The problem, though, is that i want to just ADD another clickhandler, to the apply button in the datechooser, but leave all the other functionality intact. With my autochild-code, it seems that if i click on "apply", only my new handler is called, the rest has been removed.

    Anybody have any smart ideas?

    My code:
    Code:
    final DateTimeItem inField = (DateTimeItem) editor.getForms().get(0).getField(ServerConstants.FIELD_INTIME);
    final DateTimeItem outField = (DateTimeItem) editor.getForms().get(0).getField(ServerConstants.FIELD_OUTTIME);
    
    final DateChooser inPicker = new DateChooser();
    
    IButton applyButton = new IButton();
    applyButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent clickEvent) {
            if(outField.getValue() == null){
                outField.setValue(inPicker.getData());
            }
        }
    });
    inPicker.setAutoChildProperties("applyButton", applyButton);
    inField.setAutoChildProperties("picker", inPicker);
    //inField.setPickerProperties(inPicker);

    Leave a comment:


  • Blama
    replied
    Hi mathias,

    this is most likely an AutoChild use case.

    Best regards
    Blama

    Leave a comment:


  • How do i add clickhandler to Apply button of datetimeitem picker?

    smartgwt pro5.0, 2014-09-11

    I'm trying, but getting an error here's what i do:
    Code:
    final DateTimeItem inField = (DateTimeItem) editor.getForms().get(0).getField(Constants.FIELD_INTIME);
          
    DateChooser inPicker = new DateChooser();
    inPicker.getApplyButton().addIconClickHandler(new com.smartgwt.client.widgets.events.IconClickHandler() {
        @Override
        public void onIconClick(com.smartgwt.client.widgets.events.IconClickEvent iconClickEvent) {
            SC.say("APPLY!! HAHAHAAAAA");
        }
    });
    
    inField.setPickerProperties(inPicker);
    However, i get this error:
    java.lang.IllegalStateException: Cannot access property applyButton before the widget has been created.

    But i created it myself?

    Am i missing something obvious?


    EDIT: what i'm trying to accomplish is putting a clickhandler on the "apply" so that i can manually set the "intime" value as a starting-value for the "outtime" field, if it is empty. It will save time for the users.
Working...
X