Announcement

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

    Grid Summary Row Data Source

    Smart GWT 2.5 Power Edition

    I have successfully tied a grid to data source backed by an Oracle table. I would now like to add grid summary line that captures the total rows associated with the last fetch operation.

    I cloned the current data source definition file and gave it a new unique ID. I added the following operation binding to the bottom of it to capture the count.

    Code:
    <operationBinding operationType="fetch">
      <selectClause>select COUNT(ID)</selectClause>
    </operationBinding>
    On the client side, I have the following new logic:

    Code:
    mGrid.setShowGridSummary(true);
    mGrid.setSummaryRowDataSource(sortSummaryDS);
    ListGridSummaryField totalField = new ListGridSummaryField("COUNT(ID)", "Total");
    totalField.setAlign(Alignment.RIGHT);
    totalField.setShowGridSummary(true);
    Finally, I make sure the totalField is added to the grid field list. The summary is not being loaded properly, so I appear to be doing something wrong.

    Questions:

    1 - Did I construct the DS operationBinding properly?
    2 - I used the field name of "COUNT(ID)" for the ListGridSummaryField - is that correct?
    3 - Does the summary row data source automatically fetch when the grid does or do I need to explicitly do that?

    Thanks.

    #2
    No need for any of that, the total number of rows is available via calling ListGrid.getTotalRows() as soon as the DataArrived event fires.

    Comment


      #3
      Much easier to implement and it works perfectly.

      Thank you.

      Comment

      Working...
      X