Showing rows without the selected values

4 posts, 0 answers
  1. Jeremy
    Jeremy avatar
    3 posts
    Member since:
    Mar 2014

    Posted 28 Mar 2014 Link to this post

    I'm working with the pivot grid trying to have it show sub-groups that do not have a certain status as well as only showing two particular values "Pending" & "Granted"

    Dataset:
    DataTable table = new DataTable();
    table.Columns.Add("Product And Business Group");
    table.Columns.Add("Platform Or SubGroup");
    table.Columns.Add("Status");
     
    table.Rows.Add("Core", "Core Sub Group", "Granted");
    table.Rows.Add("Core", "Core Sub Group", "Pending");
    table.Rows.Add("Core", "Sub Group should be shown in Core", "Some Other Value");
     
    table.Rows.Add("Non-Core", "Non-Core Sub Group", "Granted");
    table.Rows.Add("Non-Core", "Non-Core Sub Group", "Pending");
    table.Rows.Add("Non-Core", "Sub Group should be shown in Non-Core", "zAnother value");

    Grid:
    <telerik:RadPivotGrid ID="RadPivotGrid1" 
                        PageSize="20" runat="server"
                        AllowFiltering="true" TotalsSettings-GrandTotalsVisibility="None" RowHeaderZoneText="Business Group" DataSourceID="ObjectDataSource1" Skin="Windows7" EmptyValue="0">
                        <TotalsSettings GrandTotalsVisibility="RowsOnly" ColumnsSubTotalsPosition="Last" RowsSubTotalsPosition="Last" />
                        <ConfigurationPanelSettings/>
                        <RowHeaderCellStyle Width="200px" />
                        <Fields>
                            <telerik:PivotGridRowField Caption="Product And Business Group" DataField="Product And Business Group" >
                            </telerik:PivotGridRowField>
                            <telerik:PivotGridRowField Caption="Platform or sub-group" DataField="Platform Or SubGroup" ShowGroupsWhenNoData="false">
                            </telerik:PivotGridRowField>
                            <telerik:PivotGridColumnField Caption="Status" DataField="Status" UniqueName="Status">
                            </telerik:PivotGridColumnField>
                            <telerik:PivotGridAggregateField Aggregate="Count" DataField="Status" DataFormatString="{0:D0}" UniqueName="StatusCount" >
                                <TotalFormat Axis="Rows" Level="0" SortOrder="Ascending" TotalFunction="NoCalculation" />
                            </telerik:PivotGridAggregateField>
                        </Fields>
                        <ClientSettings>
                            <Scrolling AllowVerticalScroll="false" ScrollHeight="600px" />
                        </ClientSettings>
     
                    </telerik:RadPivotGrid>

    Filter:
    RadPivotGrid1.SetFilterIncludes("Status", new string[] { "Pending", "Granted" }, true);

    I've tried playing around with the ShowGroupsWhenNoData property but that adds the sub groups to all of the groups, which I do not want (Pivot_Filtered_ShowGroupsWhenNoData.PNG)


    Expected outcome: Pivot_Filtered_Expected.PNG (Attached)
    Actual outcome: Pivot_Filtered.PNG (Attached)

    To summarize
    I'm trying to achieve the view in Pivot_Filtered_Expected.PNG which is only showing the "Pending" and "Granted" columns. I also want to display sub-groups that do not have one of those status (so their values would be 0 and 0 respectively).

    The problems I'm having now is it either shows the values that I do not want (if I don't have a filter) or it includes the sub-groups in the wrong business group (ShowGroupsWhenNoData).

    Any advice on accomplishing the view I'm looking for?
  2. Marin
    Admin
    Marin avatar
    1045 posts

    Posted 02 Apr 2014 Link to this post

    Hi,

    The ShowGroupsWhenNoData property will affect all the values in a field, so when set to true, it will also show Non-core subgroups in the Core group and Core sub groups in Non-core group. Unfortunately the grid does not support at the moment such type of selective filtering of the data where only core sub groups will be shown in the core group and non-core sub groups in the Non-Core group.

    Regards,
    Marin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jeremy
    Jeremy avatar
    3 posts
    Member since:
    Mar 2014

    Posted 02 Apr 2014 in reply to Marin Link to this post

    Thanks for the information. Any tips on maybe how to hack in the functionality I'm looking for? Like hiding columns or injecting rows manually?
  5. Marin
    Admin
    Marin avatar
    1045 posts

    Posted 03 Apr 2014 Link to this post

    Hello,

    We have replied to your support ticket on the same issue. Basically you can try the CellDataBound event to hide cells from the pivot grid based on your custom criteria:

    protected void RadPivotGrid1_CellDataBound(object sender, PivotGridCellDataBoundEventArgs e)
        {
            var rowHeaderCell = e.Cell as PivotGridHeaderCell;
            var dataCell = e.Cell as PivotGridDataCell;
            if (rowHeaderCell != null)
            {
                if (rowHeaderCell.ParentIndexes != null && rowHeaderCell.ParentIndexes.Length > 0)
                {
                    if ((rowHeaderCell.Text == "Core Sub Group" || rowHeaderCell.Text == "Sub Group should be shown in Core") &&
                        rowHeaderCell.ParentIndexes[0] != "Core")
                    {
                        rowHeaderCell.Style["display"] = "none";
                    }
     
                    if ((rowHeaderCell.Text == "Non-Core Sub Group" || rowHeaderCell.Text.Contains("Sub Group should be shown in Non-Core")) &&
                        rowHeaderCell.ParentIndexes[0] != "Non-Core")
                    {
                        rowHeaderCell.Style["display"] = "none";
                    }
     
                }
            }
     
            if (dataCell != null)
            {
                if (dataCell.Text == "0" && dataCell.ParentRowIndexes.Length == 2 &&
                    (dataCell.ParentRowIndexes[0] == "Core" && (dataCell.ParentRowIndexes[1] == "Non-Core Sub Group" || dataCell.ParentRowIndexes[1] == "Sub Group should be shown in Non-Core") ||
                     dataCell.ParentRowIndexes[0] == "Non-Core" && (dataCell.ParentRowIndexes[1] == "Core Sub Group" || dataCell.ParentRowIndexes[1] == "Sub Group should be shown in Core")))
                {
                    dataCell.Style["display"] = "none";
                }
            }
        }


    We can continue any further communication on the problem in the support ticket in order to avoid duplicate posts here.

    Kind Regards,
    Marin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top