Reputation: 1
[DisplayName("Team"), LookupEditor(typeof(TeamRow))]
public int? TeamId
{
get => fields.TeamId[this];
set => fields.TeamId[this] = value;
}
[DisplayName("Assigned To"), LookupEditor(typeof(UserRow), cascadfrom = "TeamId"), TextualField("Username")]
public int? AssignedTo
{
get => fields.AssignedTo[this];
set => fields.AssignedTo[this] = value;
}
I create a Serenity form with team and user columns. now i have to select the dropdown users based on the team. the team have multi select in user table. can anyone help me with this
Upvotes: 0
Views: 73
Reputation: 11
You need to add CascadeField to match the TeamId with the field on your UsersRow. Like below:
[DisplayName("Assigned To"), LookupEditor(typeof(UserRow), CascadeField = "TeamId", CascadeFrom = "TeamId"), TextualField("Username")]
public int? AssignedTo
{
get => fields.AssignedTo[this];
set => fields.AssignedTo[this] = value;
}
Upvotes: 0
Reputation: 1
public inputID: number;
protected afterLoadEntity() {
super.afterLoadEntity();
this.inputID = this.entity.TeamId;
this.form.AssignedTo.cascadeValue = 6;
}
Try using this code in dialog.ts file.
Upvotes: 0