Totals in footer

4 posts, 0 answers
  1. Dipti
    Dipti avatar
    37 posts
    Member since:
    Dec 2011

    Posted 15 Feb 2012 Link to this post

    Hi,

    I have used aggregate sum function in my grid to show the totals. I am using RadPager, and i display 10 records at a time.

    the issue is the footer aggregate shows total of all records and not the records on current page.
    i.e. if i have 25 records and currently 10 records are displayed, the footer shows sum of 25 records. We were expecting to see total of only 10 records as only 10 records are displayed currently.

    Is this an issue or am i doing something wrong?

    Regards,
    Dipti
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2477 posts

    Posted 15 Feb 2012 Link to this post

    Hello,

    You can try to pass in the input source collection to RadDataPager.Source and then bind RadGridView.ItemsSource to RadDataPager.PagedSource.

    Please, read my blog for more info. It explains this alternative configuration.

    Regards,
    Ross
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. Dipti
    Dipti avatar
    37 posts
    Member since:
    Dec 2011

    Posted 15 Feb 2012 Link to this post

    Hi,

    I have done as you have suggested.

    This is what I have done:

    XAML
    <telerik:RadGridView x:Name="radGridViewCreditAnalysis" Width="470" Height="332" IsReadOnly="True" RowIndicatorVisibility="Collapsed" ShowGroupPanel="False" ItemsSource="{Binding PagedSource, ElementName=rdPagerCreditAnalysis}"
     <telerik:RadGridView.Columns>
    <telerik:GridViewDataColumn Header="Credit Limit" CellStyleSelector="{StaticResource creditLimitStyleSelector}" FooterTextAlignment="Right" Width="91" 
                        DataMemberBinding="{Binding Path=CreditLimit, Converter={StaticResource NegativeNumberConverter}}" IsFilterable="False" TextAlignment="Right" HeaderTextAlignment="Center"
                        HeaderCellStyle="{StaticResource IntranetGridViewHeaderCellStyle}" FooterCellStyle="{StaticResource IntranetGridViewFooterCellStyle}" >
                        <telerik:GridViewColumn.AggregateFunctions>
                            <telerik:SumFunction />
                        </telerik:GridViewColumn.AggregateFunctions>
                        <telerik:GridViewDataColumn.Footer>
                            <StackPanel Background="Transparent">
                                <telerik:AggregateResultsList ItemsSource="{Binding}" VerticalAlignment="Center">
                                    <ItemsControl.ItemTemplate>
                                        <DataTemplate>
                                            <StackPanel Orientation="Horizontal" VerticalAlignment="Center" >
                                                <TextBlock VerticalAlignment="Center" Text="{Binding FormattedValue,Converter={StaticResource NegativeNumberConverter}}" />
                                            </StackPanel>
                                        </DataTemplate>
                                    </ItemsControl.ItemTemplate>
                                </telerik:AggregateResultsList>
                            </StackPanel>
                        </telerik:GridViewDataColumn.Footer>
                        <telerik:GridViewColumn.CellTemplateSelector>
                            <local:CreditTemplate>
                                <local:CreditTemplate.EmptyDataTemplate>
                                    <DataTemplate>
                                        <TextBlock />
                                    </DataTemplate>
                                </local:CreditTemplate.EmptyDataTemplate>
                            </local:CreditTemplate>
                        </telerik:GridViewColumn.CellTemplateSelector>
                    </telerik:GridViewDataColumn>
    </telerik:RadGridView.Columns>
            </telerik:RadGridView>
      
      
    <telerik:RadDataPager x:Name="rdPagerCreditAnalysis" PageSize="{Binding pagesize}" IsTotalItemCountFixed="True" Source="{Binding int, ElementName=radGridViewCreditAnalysis}" />


    C#:
    this.rdPagerCreditAnalysis.PageSize = 10;
    this.rdPagerCreditAnalysis.Source = listUtilization;

    But the total on each page is same and equal to total of the entire collection.

    Thanks
  4. Dipti
    Dipti avatar
    37 posts
    Member since:
    Dec 2011

    Posted 28 Feb 2012 Link to this post

    Telerik team,
    Please help, I've given my code in previous post.

    Regards,
    Dipti
Back to Top