gwt - how can i trigger clickEvent on FileUpload widget?

后端 未结 3 576
小蘑菇
小蘑菇 2021-01-14 03:25

I\' m trying to create a simple Button and when it\'s clicked I want to trigger a hidden FileUpload widget which is inside a FormPanel. What I have done until now is two thi

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-14 03:48

    You can also use JSNI like this:

    private native void triggerClick(Element e) /*-{
        e.click();
    }-*/;
    

    Then call

    triggerClick(fileInput.getElement());
    

提交回复
热议问题