0

I have a listbox. I want to fire a click event which clicks this listbox and we can see the items inside the list.

Things I have tried and did not work-

1)   

  DomEvent.fireNativeEvent(Document.get().createClickEvent(0, 0, 0, 0, 0,
    false, false, false, false), listbox);

2)

 public static native void click(ListBox listbox)/*-{
  listbox.click();
  }-*/;

3)
  DomEvent.fireNativeEvent(Document.get().createChangeEvent(), yourListBox);
Akshat Agarwal
  • 2,837
  • 5
  • 29
  • 49

1 Answers1

0

This works, but only in chrome.

listbox.getElement().dispatchEvent(
    Document.get().createMouseDownEvent(0, 0, 0, 0, 0, 
            false, false, false, false, Event.BUTTON_LEFT));

See also How can you programmatically tell an HTML SELECT to drop down (for example, due to mouseover)?

Community
  • 1
  • 1
Monyak
  • 38
  • 1
  • 6