Results 1 to 3 of 3

Thread: ListView Double Click

  1. #1
    Sencha User
    Join Date
    May 2011
    Posts
    51
    Answers
    2

    Default Answered: ListView Double Click

    I can't seem to find any way existing way to catch list view double clicks. Is there something in place that will do this or do I need to extend ListView?

  2. Easy:

    Code:
    listView.addDomHandler(new DoubleClickHandler() {
                @Override
                public void onDoubleClick(DoubleClickEvent event) {
                    final String selectedItem = listView.getSelectionModel().getSelectedItem();
                    if (selectedItem != null) {
                       //TO what ever you want
                    }
                }
            }, DoubleClickEvent.getType());

  3. #2
    Sencha Premium Member
    Join Date
    Aug 2012
    Posts
    49

    Default

    I have done this with code similar to the following. Hope this helps
    Code:
    myListView.setCell(new AbstractCell<String>("dblclick") {
    
                @Override
                public void render(com.google.gwt.cell.client.Cell.Context context, String value,
                        SafeHtmlBuilder sb) {
                    sb.appendEscaped(value);
                }
    
                @Override
                public void onBrowserEvent(com.google.gwt.cell.client.Cell.Context context, Element parent,
                        String value, NativeEvent event, ValueUpdater<String> valueUpdater) {
                    super.onBrowserEvent(context, parent, value, event, valueUpdater);
                    if ("dblclick".equals(event.getType())) {
                        //action to take on double click
                    }
                }
            });

  4. #3
    Sencha Premium Member
    Join Date
    Dec 2012
    Posts
    100
    Answers
    5

    Default

    Easy:

    Code:
    listView.addDomHandler(new DoubleClickHandler() {
                @Override
                public void onDoubleClick(DoubleClickEvent event) {
                    final String selectedItem = listView.getSelectionModel().getSelectedItem();
                    if (selectedItem != null) {
                       //TO what ever you want
                    }
                }
            }, DoubleClickEvent.getType());

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •