3 Answers, 1 is accepted
0
Hello Thomas,
Thank you for writing.
This property has a private setter, so you would need reflection in order to change it:
If you provide me with additional information of what exactly you are trying to accomplish, perhaps we could also find a different solution.
I hope this helps. Should you have further questions please do not hesitate to write back.
Regards,
Hristo Merdjanov
Telerik
Thank you for writing.
This property has a private setter, so you would need reflection in order to change it:
IPivotFieldInfo myFieldInfo =
this
.radPivotFieldList1.ViewModel.Fields[1].FieldInfo;
if
(myFieldInfo !=
null
)
{
PropertyInfo pi = myFieldInfo.GetType().GetProperty(
"AllowedRoles"
, BindingFlags.Public | BindingFlags.Instance);
{
if
(pi !=
null
)
{
FieldRoles myRole = FieldRoles.Column;
pi.SetValue(myFieldInfo, myRole);
}
}
}
If you provide me with additional information of what exactly you are trying to accomplish, perhaps we could also find a different solution.
I hope this helps. Should you have further questions please do not hesitate to write back.
Regards,
Hristo Merdjanov
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
Thomas
Top achievements
Rank 1
answered on 24 Jun 2015, 06:55 PM
Hello Hristo Merdjanov,
I want to dynamically fill a Pivotgrid with fields defined in a datatable.
Here I want to define the important Informations:
1. Datafield
2. Sortfield for a sorting different from the datafield
3. Define the Allowed Roles (R=Rowgroup, C=Columngroup, V=Value, F=Filter)
4. Define the prefered Role
5. Prefered Aggregate
I can't define the Fieldinfo so I had to generate a dynamic SQL Command to only get the Fields i wanted.
Reflection is a Solution but not really a good one. The ebst wouöd be to have a Editor to define the fieldinfo.
AutogenerateFields=false together with a FieldInfoCollection.
Thank You for your answer.
Best regards
Thomas
0
Hi Thomas,
Thank you for writing back.
The scenario, as you describe it, interferes with the internal mechanism of how RadPivotGrid works. There is no exposed API to allow such modifications and all these members are being set privately and depend on numerous factors. Modifying them outside of their internal environment would not be possible as this will obstruct the way how the view model passes data between the view and the models.
Should you have further questions please do not hesitate to write back.
Regards,
Hristo Merdjanov
Telerik
Thank you for writing back.
The scenario, as you describe it, interferes with the internal mechanism of how RadPivotGrid works. There is no exposed API to allow such modifications and all these members are being set privately and depend on numerous factors. Modifying them outside of their internal environment would not be possible as this will obstruct the way how the view model passes data between the view and the models.
Should you have further questions please do not hesitate to write back.
Regards,
Hristo Merdjanov
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