Jamie
Jamie

Reputation: 1

dynamic validators and itemrenderer

I have a bunch of dynamic validators that I create in my application.

I have an mxml which contains a s:DataGroup. The DataGroup contains an itemRenderer. In this itemRenderer, I have a combobox which I want to validate.

I perform the validation like this ont the creationComplete of the itemRenderer:

protected function creationCompleteHandler(event:FlexEvent):void
{
    var condition:Condition = data as Condition;
    condition.validator.source = valuesComboBox.textInput;
    condition.validator.property= "text";
}

Of course, when I do this, the itemrenderer is recycling, and the validator appears in places in which i do not want it to.

Anybody have any idea how i can work around this problem?

Thanks, Jamie

Upvotes: 0

Views: 491

Answers (1)

Constantiner
Constantiner

Reputation: 14221

Why not to validate selectedItem of ComboBox and use ComboBox as a source:

protected function creationCompleteHandler(event:FlexEvent):void
{
    var condition:Condition = data as Condition;
    condition.validator.source = valuesComboBox;
    condition.validator.property= "selectedItem";
}

Upvotes: 2

Related Questions