Announcement

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

    TreeGridField RecordClick not working correctly with Firefox

    Hi,

    I'm here to ask for you help for this very strange situation.

    I'm using SmartGwt 4.0 and I have a problem with the RecordClick event defined on a TreeGridField. The wierd thing is that everything seems to works fine in IE and Chrome but not with FF (I used FF17 and FF23).

    When I click on the TreeGridField named "controls" a popup should appear.
    In IE when I clickon the field of the already selected record the popup shows up, when I click on the field of another record the selection changes and the popup shows up.
    In FF the popup shows only for already selected records, when I click on the field of another record the selection changes but the popup is not show.

    Here is a sample code:
    Code:
    TreeGrid _treeview = new TreeGrid() ;
    _treeview.setWidth100();
    _treeview.setHeight100();
    _treeview.setAutoFetchData(true);
    _treeview.setLoadDataOnDemand(false);
    _treeview.setShowConnectors(true);
    _treeview.setShowHeader(true);
    _treeview.setShowSelectedStyle(true);
    _treeview.setDataSource(getTreeviewDataSource());
    _treeview.setSelectionType(SelectionStyle.SINGLE);
    _treeview.setIconSize(16);
    _treeview.setAutoFitIconFields(AutoFitIconFieldType.NONE);
    // when selection changed update otherview
    _treeview.addSelectionUpdatedHandler(new SelectionUpdatedHandler() {
    
    @Override
    public void onSelectionUpdated(SelectionUpdatedEvent event) {
       if (_treeview.getSelectedRecord() != null) {
             //some custom code
             SC.say("selection updated");
       }
    }
    
    });
    _treeview.addDataArrivedHandler(new DataArrivedHandler() {
    
            @Override
            public void onDataArrived(DataArrivedEvent event) {
               _treeview.showField("controls");                            
            }
    
        });     
    
    
    final TreeGridField controlsField = new TreeGridField("controls");
    controlsField.setCanSort(false);
    controlsField.setCanHide(false);
    controlsField.setType(ListGridFieldType.ICON);
    controlsField.setCellIcon("[SKIN]headerIcons/settings.png");
    controlsField.setCellAlign(Alignment.CENTER);
    controlsField.setWidth(25);
    //hidden, so connectors will be drawn on nameField.
    controlsField.setHidden(true);
    controlsField.setFrozen(true);
    controlsField.addRecordClickHandler(new RecordClickHandler() {
    
        @Override
        public void onRecordClick(RecordClickEvent event) {
            SC.say("Controls clicked");
        }
    });
    
    final TreeGridField nameField = new TreeGridField("myname");
    nameField.setCanSort(false);
    nameField.setCanHide(false);
    
    _treeview.setFields(controlsField, nameField);
    It seems to me that the problem has something to do with the selectionUpdate event that in some way cancel the record click event on the field. As I already explained, this happens only in FF.

    Please help me found out a solution.
    Thank you
    Barbara

    #2
    Solved!

    Never mind!!!

    I found that the problem is due to an external JS.


    Sorry :)

    Comment


      #3
      For those who may have the same problem.

      The recordclick event was stopped by an ovelay div (kind of "wait please...") that I show onselectionupdated to prevent the user to click on the page while another panel loads.

      I think that FF register two distinct events selectionupdated and recordclick, but since the div shows up right after the selectionupdated the second event is intercepted by the div.

      I try to show the div in a smaller area instead that on the whole page and the recordclick event fired correctly.

      Searching the web I found a workaround by adding a css rule to the overlay div just for FF.

      Code:
      @-moz-document url-prefix() {
         	.ui-widget-overlay{
         		pointer-events: none;
      	}
      }
      Unfortunately this way the user can actually click the objects behind the div, but this is the best I could get.

      Comment

      Working...
      X