Is there an event that fires when the rows are generated?

                    <PivotViewRows>

                        <PivotViewRow Name="A" ShowNoDataItems="false"></PivotViewRow>

                         <PivotViewRow Name="B" ShowNoDataItems="false"></PivotViewRow>

                    </PivotViewRows>


Is there a way to disable the drill down based on a value that is found within the dataset for the row OR

Either hide or remove the PivotViewRow "B" completely if a value is found within the dataset for that row.   

I only want to show the drill down child row on certain rows.




5 Replies

MM Manikandan Murugesan Syncfusion Team March 7, 2022 02:49 PM UTC

Hi Jason, 
 
If you want to disable row header rendering when we expand specific row header at runtime, we're regret to inform that we don't have an option for that in our pivot table right now. 
 
If this is different from your requirement, then please let us know the more details with screen shot/video (if possible), so that we can work towards fulfilling your requirement. 
 
Regards, 
Manikandan 



JB Jason Bishop March 8, 2022 01:30 AM UTC

It is my understanding you get a drill down arrow when you have more than one pivoviewrow like:


                    <PivotViewRows>

                        <PivotViewRow Name="A" ShowNoDataItems="false"></PivotViewRow>

                         <PivotViewRow Name="B" ShowNoDataItems="false"></PivotViewRow>

                    </PivotViewRows>

You click A to drilldown/view  B in the fist row of the pivot.  I want to hide or disable row B if A = X so that there is no drill down for that row of data.



MM Manikandan Murugesan Syncfusion Team March 8, 2022 09:57 AM UTC

Hi Jason, 

In the pivot table, you can't hide the entire row based on the header name. The "EnginePopulated" event, on the other hand, can be used to remove the values from that row. For more information, see the code example below. 

Code Example: 
    private void EnginePopulated(EnginePopulatedEventArgs args) 
    { 
        for (var i = 0; i < args.PivotValues.Count(); i++) 
        { 
            for (var j = 0; (args.PivotValues[i] != null && j < args.PivotValues[i].Count()); j++) 
            { 
                if (args.PivotValues[i][0] != null && args.PivotValues[i][j] != null && args.PivotValues[i][0].Axis == "row") 
                { 
                    var rowHeaders = (args.PivotValues[i][0].ValueSort["levelName"] as string).Split(new[] { pivot.DataSourceSettings.ValueSortSettings.HeaderDelimiter }, StringSplitOptions.None); 
                    if (args.PivotValues[i][0].FormattedText != "France" && rowHeaders.Contains("France")) 
                    { 
                        args.PivotValues[i][j].FormattedText = ""; 
                    } 
                } 
            } 
        } 
    } 

Screenshot: 
 
Meanwhile, we have prepared a sample for your reference. Please find it from below link. 

Please let us know if you have any concerns. 

Regards, 
Manikandan 



JB Jason Bishop March 18, 2022 12:13 AM UTC

Thanks for pointing me in the right direction however this still had the rows present....empty but present.  I was able to accomplish what I needed by setting the haschild to false.


    private void EnginePopulated(EnginePopulatedEventArgs args)

    { if (pivotAgingRates != null)

        {

            for (var i = 0; i < args.PivotValues.Count(); i++)

            {

                for (var j = 0; (args.PivotValues[i] != null && j < args.PivotValues[i].Count()); j++)

                {

                    if (args.PivotValues[i][0] != null && args.PivotValues[i][j] != null && args.PivotValues[i][0].Axis == "row")

                    {

                        var rowHeaders = (args.PivotValues[i][0].ValueSort["levelName"] as string).Split(new[] { pivotAgingRates.DataSourceSettings.ValueSortSettings.HeaderDelimiter }, StringSplitOptions.None);

                        if (!rowHeaders.Contains("XXXXX"))

                        {

                            args.PivotValues[i][0].HasChild = false;

                        }

                    }

                }

            }

        }

    }



MM Manikandan Murugesan Syncfusion Team March 18, 2022 03:04 PM UTC

Hi Jason, 
 
Please let us know if you have any other queries. We are always happy to assist you. 
 
Regards, 
Manikandan 


Loader.
Up arrow icon