5 Answers, 1 is accepted
0
Hello Jens,
Thank you for writing.
It is suitable to use the RadPivotGrid.GroupElementFormatting event where you can specify the desired text for the PivotGroupElementEventArgs.CellElement and achieve the required numbering. You can refer to the PivotGrid >> Formatting appearance help article for additional information.
I hope this information helps. Should you have further questions I would be glad to help.
Regards,
Dess
Telerik
Thank you for writing.
It is suitable to use the RadPivotGrid.GroupElementFormatting event where you can specify the desired text for the PivotGroupElementEventArgs.CellElement and achieve the required numbering. You can refer to the PivotGrid >> Formatting appearance help article for additional information.
I hope this information helps. Should you have further questions I would be glad to help.
Dess
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Jens
Top achievements
Rank 1
answered on 01 Oct 2015, 08:01 AM
Hey Dess,
thanks, thats a nice way to inject some text.
But how to get the indices for the top level groups? I've tried GroupElement.Data.Index, but that results in in numbering all sub groups. In the screenshot the red numbers show my "targeted numbering" ;)
Cheers,
Jens
0
Hello Jens,
Thank you for writing back.
You can access the GroupElement.Data.Group.Level and apply the numbering only to the desired level. Thus, in a counter you can store the number:
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Telerik
Thank you for writing back.
You can access the GroupElement.Data.Group.Level and apply the numbering only to the desired level. Thus, in a counter you can store the number:
int
cnt = 1;
private
void
radPivotGrid1_GroupElementFormatting(
object
sender, Telerik.WinControls.UI.PivotGroupElementEventArgs e)
{
if
(e.GroupElement.Data.Group.Level == 0)
{
e.GroupElement.Text =
string
.Format(
"{0}.{1}"
, cnt, e.GroupElement.Text);
cnt++;
}
}
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Jens
Top achievements
Rank 1
answered on 02 Oct 2015, 08:49 AM
Hey Dess,
The Formatting Event is called multiple times due to Re(paint) events, so you end up with very wrong numbers after scrolling ^^
Cheers,
Jens
0
Hello Jens,
Thank you for writing back.
You can use a Dictionary to store the correct number for the GroupElement. Thus, when scrolling, you can use the stored value, instead of increasing the counter. Here is a sample a code snippet:
Note that this is just a sample approach and it may not cover all possible cases. Feel free to modify it in a way which suits your requirement best.
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Telerik
Thank you for writing back.
You can use a Dictionary to store the correct number for the GroupElement. Thus, when scrolling, you can use the stored value, instead of increasing the counter. Here is a sample a code snippet:
int
cnt = 1;
Dictionary<
object
,
string
> numbers =
new
Dictionary<
object
,
string
>();
private
void
radPivotGrid1_GroupElementFormatting(
object
sender, Telerik.WinControls.UI.PivotGroupElementEventArgs e)
{
if
(e.GroupElement.Data.Group.Level == 0 && e.GroupElement.Parent.Class ==
"RowsContainer"
)
{
if
(numbers.ContainsKey(e.GroupElement.Data))
{
e.GroupElement.Text =
string
.Format(
"{0}.{1}"
, numbers[e.GroupElement.Data], e.GroupElement.Text);
}
else
{
e.GroupElement.Text =
string
.Format(
"{0}.{1}"
, cnt, e.GroupElement.Text);
numbers.Add(e.GroupElement.Data, cnt.ToString());
cnt++;
}
}
}
Note that this is just a sample approach and it may not cover all possible cases. Feel free to modify it in a way which suits your requirement best.
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items