views:

124

answers:

2

In my Combo box i have to shows team names condition based . So i will try like

dataProvider="{usersXML.users.user.(id=10).name}" but shows some errors . but if i tried

dataProvider="{usersXML.users.user.name}" display all name . It's working .

How can i condition based to display the list . In combobox . Plz refer me . is it possiable to check array of id on the dataProvider ?

+1  A: 

It seems like this is more an E4X question than one to do with the Combo box specifically. Did you try:

usersXML.users.user.(@id==10).name
vitch
i tried vitch . but shows some errors
R.Vijayakumar
some error is not helpful - post the error message- And did you notice that there is an `@` and `==` that was missing in your code?
Amarghosh
Data binding will not be able to detect assignments to "id" . it is an error .
R.Vijayakumar
That is because databinding wouldn't be able to detect if the usersXML changed and the the username changed. Do you need the value to automagically update when the XML changes or do you just need to set the initial value of the name?
vitch
@vijay - are you sure that's an error - it used to be a warning. What version of flex are you using?
Amarghosh
i used flex3 - Sdk3 Mr.Amarghosh
R.Vijayakumar
A: 

I think you're going about it the wrong way. Have you tried storing something like this:

[Bindable]
var targetList:XMLList

function setID( id:int ):void
{
 var tmpList:XMLList = usersXML.users.user.( @id==id );

 if( tmpList && tmpList.length() && [email protected]().length )
 {
  targetList = tmpList
 }
}

If you use the above to set the id, then you can run tests to make sure that user ID and the appropriate name attribute definitely exists in this case.

To get the XML to point to this object:

<mx:Combobox dataprovider="targetList" />
Christopher W. Allen-Poole