Announcement

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

    ContextClick handler for group summaries

    Hello Iso,

    we have encountered a difficulty showing a context menu for group summaries.
    In short, when either rowContextClickHandler or cellContextClickHandler are added to a listGrid they do not fire when a group summary row is 'context'-clicked whereas clicking a regular record (row/cell) fires respective event.

    TestCase can be made easily by taking https://www.smartclient.com/smartgwt...tured_category and attaching either contextClickHandler to the grid.

    Code:
     listGrid.addRowContextClickHandler(event -> {          
       listGrid.getField(event.getColNum()).setTitle("Clickyclick");          
       listGrid.refreshFields();
     });  
    
    listGrid.addCellContextClickHandler(event -> {          
       listGrid.getField(event.getColNum()).setTitle("Clickyclick2");          
       listGrid.refreshFields();
     });
    This way you can see that clicking a regular record fires the event but is ignored by the summary record.

    Is this intentional?

    (SmartClient Version: v11.1p_2017-10-13/Pro Deployment (built 2017-10-13),
    Chrome v. 63.0.3239.132)

    #2
    Hello Isomorphic,

    could I get a confirmation that this behaviour really is intentional?

    Thanks

    Comment


      #3
      The Grid summaryRow is not a true record in the grid, but a separate ListGrid (the Grid's summaryRow autoChild), so the rowContextClick handler isn't fired because it's not applied to the summaryRow-grid.

      You can do that with this code:

      Code:
              ListGrid sRow = new ListGrid();
              sRow.addRowContextClickHandler(new RowContextClickHandler() {
                  @Override
                  public void onRowContextClick(RowContextClickEvent event) {
                      SC.say("rowContextClick");
                  }
              });
              listGrid.setAutoChildProperties("summaryRow", sRow);
      Group summaryRows are considered disabled, and that's why they don't fire this handler (or others) - we're looking at whether to expose the handler that would let you override this (SmartClient API, cellIsEnabled()) - we'll update here when we have more information.

      Last edited by Isomorphic; 10 Feb 2018, 01:11.

      Comment


        #4
        By way of a quick follow-up - note that we'll add a CellIsEnabled customizer to the upcoming release, 12.0.

        In the meantime, you can install the handler we noted previously onto the summaryRow autoChild to deal with Grid-level summaries, and install a regular ContextClickHandler on the grid, in which you call getRecord(getEventRow()) to retrieve the record under the mouse, including Group-level summary-rows.
        Last edited by Isomorphic; 10 Feb 2018, 01:09.

        Comment

        Working...
        X