Multiple parents in Cascading Drop Downs in MonoRail
Apparently I am suffering from the Bug Duplication Syndrom. Shortly after posting about cascading drop downs in MonoRail, I realized that I have actually duplicated a bug that I have run into while using the cascading drop down extender in the ASP.Net Ajax toolkit. That is not a fixable bug, btw, and has to do with what happens when you have more than a single parent. You can see my post about this scenario here, but be aware that the solution in that post is vulnerable to race conditions, and I have finally declared that unpracticle to use.
At any rate, I have duplicate the inability to have multiply parents in my previous solution using MonoRail. And I decided that instead of fixing it in place, I'll show the steps neccesary to fix the problem. Basically, we want to update both the secondaries select and the tertiaries select, which means that our GetSecondaryProfressionsByPrimary.brailjs will now contains:
page.Replace( 'secondaries',
Form.Select('secondaries',SecondaryProfessions,
{@value: @Id, @text: @Name, @firstoption: res.Select})
)
page.Replace( 'tertiaries',
Form.Select('tertiaries',TertiaryProfessions,
{@value: @Id, @text: @Name, @firstoption: res.Select})
)
page.Call( @hookSecondariesChangeEvent );
And that the GetSecondaryProfressionsByPrimary action is now:
public void GetSecondaryProfressionsByPrimary(Guid id) { PropertyBag["SecondaryProfessions"] = professionRepository.FindSecondariesByPrimaryIdOrAll(id); PropertyBag["TertiaryProfessions"] = professionRepository.FindTertiariesByPrimaryIdOrAll(id); }
Oh, and that was it.
Comments
Comment preview