Error with clientbinding and customaggreagte

7 replies. Last post: October 9, 2014 4:19 AM by Yudi
Tags :
  • (None)
Karl PietschMember

If there is a custom aggregate column and you enable client binding there is a javascript error.

var vf7178 =ISEvent.Raise(vb8528.ClientSideEvents.OnCustomAggregate,vb8528.Id,vf7470,v2d715,v4946);

 

which should be

var vf7178 =ISEvent.Raise(vb8528.LayoutSettings.ClientSideEvents.OnCustomAggregate,vb8528.Id,vf7470,v2d715,v4946);

 

try client binding on CustomAggregation.aspx  and you will see the issue.

 

Karl

All Replies

Hi Karl,


I could replicate your issue. It caused OnCustomAggregate method always get a null value.
I have forwarded your issue to our development team for further investigation. I will let you know for any updates from them as soon as possible.


Thank you Karl.
Riendy

Is there a solution to this problem?
Yudi Member

The hotfix for the reported problem in this thread will be available in September hotfix which will be available in the last week of this month.

I also would like to remind that the way to implement custom aggregate on client-binding WebGrid is different from the server-binding WebGrid. Following properties are need to be set in order to use custom aggregate in both scenario, client-binding WebGrid and server-binding WebGrid:

  • Enable ColumnFooters property of RootTable. Example:
    <ISWebGrid:WebGrid ID="WebGrid1" runat="server" ...>    ...
        <RootTable DataKeyField="CustomerID" ColumnFooters="Yes">
            <Columns>
                ...
            </Columns>
        </RootTable>
    </ISWebGrid:WebGrid>
  • Set AggregateFunction of WebGridColumn to Custom. Example:
    <RootTable DataKeyField="CustomerID" ColumnFooters="Yes">
        <Columns>
            ...
            <ISWebGrid:WebGridColumn Caption="CompanyName"
                DataMember="CompanyName" Name="CompanyName"
                Width="100px" AggregateFunction="Custom">
            </ISWebGrid:WebGridColumn>
            ...
        </Columns>
    </RootTable>
  • Set FooterText property of WebGridColumn [optional]. Example:

  • <RootTable DataKeyField="CustomerID" ColumnFooters="Yes">
        <Columns>
            ...
            <ISWebGrid:WebGridColumn Caption="CompanyName"
                DataMember="CompanyName" Name="CompanyName"
                Width="100px" AggregateFunction="Custom" FooterText="Count : ">
            </ISWebGrid:WebGridColumn>
            ...
        </Columns>
    </RootTable>

Please note that when used in client-binding WebGrid, put the aggregate logic in OnCustomAggregate client-side event of WebGrid. This is different from server-binding WebGrid where the aggregate logic is placed in OnCustomAggregate server-side event of WebGrid. Following snippet code, WebGrid will count the total of Customers from Germany; and show the aggregate result in the footer text of CompanyName column.

function WebGrid1_OnCustomAggregate(controlId, columns, rows, type)
{
    var grid = ISGetObject(controlId);
            
    // every column that have its AggregateFunction set to Custom
    // will invoke this event when aggregate calculation is needed.
    // so we need to check against the Column's Name or DataMember
    // depend on your application's design.
    if (columns.Name == "CompanyName")
    {
        var count = 0;
        var aggregateResult = 0;
        //debugger;
        // loop through all rows
        while (count < rows.length)
        {
            // only count if country is "Germany".
            if (rows[count].Cells.GetNamedItem("Country").Value == "Germany")
                aggregateResult++;

            count++;
        }

        // return the result.
        return aggregateResult;
    }
}

Hope this help.

Thank you!  We are using the client-side customaggregate that you describe and the javascript error still occurs.  Please confirm that the September hotfix is still on schedule for the week of 9/29.

Yudi Member

I have tested the nightly build of WebGrid 8 using a simple sample of client-side custom aggreagate and find that the reported problem is no longer persist. The release version of this hotfix will be available in the next couple of days.

Please advise when the release version of the hotfix will be available.  There doesn't appear to be an update on the Support page as of yet.

Yudi Member

I enclosed the nightly build of WebGrid which implements the bugfix for client binding - custom aggregate scenario. Please download the attached hotfix and apply to your project. Feel free to let me know if the problem still persist.

All times are GMT -5. The time now is 12:03 AM.
Previous Next