This is a migrated thread and some comments may be shown as answers.

DataForm Enum problem

1 Answer 89 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
James
Top achievements
Rank 1
James asked on 07 Aug 2015, 03:27 PM

Hello,

I am running into a problem with the enum data showing up in the dropdown on the form.  Here is my entity class

 

public class fePhysician {


private String name;
private String address;
private String city;
private StateType statetype;
private String zip;
private String phone;
private String email;
private EmployeeType employeeType;
private Boolean isCustom;

@DataFormProperty(label = "Employee Type", index = 8)
public EmployeeType getEmployeeType() {
return employeeType;
}

public void setEmployeeType(EmployeeType employeeType) {
this.employeeType = employeeType;
}


@DataFormProperty(label = "IsCustom", index = 7)
public Boolean getIsCustom() {
return isCustom;
}

public void setIsCustom(Boolean isCustom) {
this.isCustom = isCustom;
}


@DataFormProperty(label = "Name", index = 0)
public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

@DataFormProperty(label = "Address", index = 1)
public String getAddress() {
return address;
}

public void setAddress(String address) {
this.address = address;
}

@DataFormProperty(label = "City", index = 2)
public String getCity() {
return city;
}

public void setCity(String city) {
this.city = city;
}

@DataFormProperty(label = "State", index = 3)
public StateType getStateType() {
return statetype;
}
public void setStateType(StateType value) {
statetype = value;
}

@DataFormProperty(label = "Zip", index = 4)
public String getZip() {
return zip;
}

public void setZip(String zip) {
this.zip = zip;
}

@DataFormProperty(label = "Phone", index = 5)
public String getPhone() {
return phone;
}

public void setPhone(String phone) {
this.phone = phone;
}

@DataFormProperty(label = "Email", index = 6)
public String getEmail() {
return email;
}

public void setEmail(String email) {
this.email = email;
}

@DataFormProperty(label = "IsCustom", index = 7)
public Boolean getIsCustom() {
return isCustom;
}

public void setIsCustom(Boolean isCustom) {
this.isCustom = isCustom;
}

 

@DataFormProperty(label = "Employee Type", index = 8)
public EmployeeType getEmployeeType() {
return employeeType;
}

public void setEmployeeType(EmployeeType employeeType) {
this.employeeType = employeeType;
}



enum EmployeeType {
PROGRAMMER

}
}

 

//This is in another file

public enum StateType {
PROGRAMMER,
MANAGER,
TEAM_LEAD,
MARKETING,
SALES
}

Also here is my code for adding the form in my fragment

RadDataForm form = new RadDataForm(ctx);
form.setEntity(new fePhysician());

form.setBackgroundColor(Color.BLUE);

container.addView(form);
return inflater.inflate(R.layout.physician_form_fragment, container, false);

 

All of the other properties work fine. However the data for the dropdowns in form is not showing up. Please assist. Can you post a working example? I am enjoying the various features in this control.

 

Cheers,

James

 

 

 

 

 

 ​

1 Answer, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 09 Aug 2015, 12:56 PM
Hello James,

Thanks for writing.
After you set the entity to the data form. You can access the editor for the EmployeeType property and set an adapter. For example:
dataForm.setEntity(new fePhysician());
((DataFormSpinnerEditor)dataForm.getExistingEditorForProperty("EmployeeType")).setAdapter(new EditorSpinnerAdapter(this, EmployeeType.values()));

Please note that in the next version RadDataForm will be able to do this automatically.


Regards,
Victor
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
Tags
DataForm
Asked by
James
Top achievements
Rank 1
Answers by
Victor
Telerik team
Share this question
or