SfDataForm - CustomEditor - DropDown (Picker)
i have the following scenario.
public class SelectableObject
{
public string Name {get;set;}
public Guid Id {get;set;}
}
public ObjectToEditInEditor
{
public string Type {get;set;}
public int Quantity {get;set;}
public SelectableObject {get;set;}
}
how can i make a custom Editor to use in the DataForm to select a SelectableObject ? the custom Editor should have an input for a SelectableObject List as the source for the picker.
Hi Andreas,
#Regarding
how can i make a custom Editor to use in the DataForm to select a
SelectableObject the custom Editor should have an input for a SelectableObject
List as the source for the picker.
Your requirement can be achieved with the help of DataFormPickerEditor to select a SelectableObject, with List as source.
Code Snippet
|
public class SelectableObject |
The example code you shared has to be changed like below
|
public class ObjectToEditInEditor { public string Type {get;set;} public int Quantity {get;set;} public string SelectableObject {get;set;} } |
We have documented ‘Loading the complex type property values in picker’ in our user guidance document. Please refer to the following UG documentation for your reference.
https://help.syncfusion.com/maui/dataform/editors#loading-the-complex-type-property-values-in-picker
Please refer to the demo sample in the attachment. Please let us know if you have any concerns.
Regards,
SaiGanesh Sakthivel
Attachment: DataFormPicker_b2d5fb20.zip
yes but i have
public ObjectToEditInEditor
{
public string Type {get;set;}
public int Quantity {get;set;}
public SelectableObject {get;set;}
}
so a direct reference to the Object and not just a string taking a value of the object.
therfor "OnGenerateDataFormItem" is not working, since as it seem, the "e.DataFormItem.FieldName" is never "SelectableObject" but "SelectableObject.Name" and
"SelectableObject.Id"
Hi Andreas,
As per the current implementation, the class cannot be directly set as the data type for the picker editor in a complex type scenario. This behavior has already been mentioned in the note section.
Note: https://help.syncfusion.com/maui/dataform/editors#loading-the-complex-type-property-values-in-picker
Regards,
SaiGanesh Sakthivel
would it be possible to make it work using a customEditor (
IDataFormEditor)
??
Andreas,
As per the implementation, the class cannot be
directly set as the data type for the custom editor. Since, it cannot be achieved
using the Custom Editor.
ok thank you
- 6 Replies
- 2 Participants
-
AN Andreas
- May 29, 2023 10:01 AM UTC
- Jun 5, 2023 02:53 PM UTC