Results 1 to 3 of 3

Thread: CheckBoxListView question

  1. #1
    Ext GWT Premium Member
    Join Date
    Jun 2008
    Location
    Poland
    Posts
    306

    Question CheckBoxListView question

    Hi,

    I'm using CheckBoxListView in GXT v2 and I want to modifer it's behavior a little bit. I mean right now I need to click on a checkbox directly to mark it. I want to select the checkbox when a user click anywhere in the area, not just on the checkbox. I tried adding OnClick listener on the CheckBoxListView, but from BaseEvent I'm not able to locale the selected clicked model. I can only get the selected model, but that's not always the same. How can I get the object reference on which the user clicked?

    Thanks in advance for any help,
    Mariusz

  2. #2
    Ext GWT Premium Member
    Join Date
    Jun 2008
    Location
    Poland
    Posts
    306

    Cool

    Never mind, found the solution:

    Code:
    view.setSelectionModel(new ListViewSelectionModel<Widget>() {
    			@Override
    			protected void handleMouseClick(com.extjs.gxt.ui.client.event.ListViewEvent<Widget> e) {
    				if (com.google.gwt.dom.client.Element.is(e.getTarget())
    						&& fly((Element) com.google.gwt.dom.client.Element.as(e.getTarget())).is(".x-view-item-checkbox")) {
    					return;
    				if (widget != null) {
    					boolean isChecked = standardList.getChecked().contains(widget);
    					standardList.setChecked(widget, !isChecked);
    				}
    							}
    
    				Widget widget = e.getModel();
    };
    		});

  3. #3
    Sencha Sr Product Manager
    Join Date
    Jan 2012
    Location
    Arlington, WA
    Posts
    1,178

    Default

    Good job. Thanks for sharing.

Posting Permissions

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