[flexcoders] Re: Strange List behaviour

2007-03-08 Thread g_odds
Thanks for all your help.  Doug, your idea gave me a different idea of
something to try which seems to work

mx:Model id=listData
  {listService.lastResult.things}
/mx:Model

mx:List
id=list
dataProvider={listData.thing}
labelField=name /

I still don't understand why that works and what I previously had
doesn't, because you are referencing exactly the same object (i.e. an
array) but in a different way.  I guess it's all to do with the crazy
Model...



--- In flexcoders@yahoogroups.com, Doug Lowder [EMAIL PROTECTED] wrote:

 It seems to me that you need to specify a property of the model as 
 the list's dataprovider, instead of using the model itself.  I 
 haven't tested this, but I'd be curious to see what happens if you 
 try the following changes:
 
 mx:Model id=listData
   things{listService.lastResult.things.thing}/things
 /mx:Model
 
 mx:List
 id=list
 dataProvider={listData.things}
 labelField=name /
 
 
 --- In flexcoders@yahoogroups.com, g_odds g_odds@ wrote:
 
  I am attempting to populate a List from Model filled by the result 
 of
  an HTTPService.  However, the list only shows one entry as [object
  Object], [object Object],...  As far as I am aware that is the 
 result
  of a toString() on a collection.  But why is the List not using that
  collection to populate itself properly (as I want it to, hehe).
  
  Thanks in advance for any help.
  
  Graham
  
  
  The code:
  
  ...
  mx:HTTPService 
  id=listService
  url=...
  /
  mx:Model id=listData
 {listService.lastResult.things.thing}
  /mx:Model
  mx:List
  id=list
  dataProvider={listData}
  labelField=name
  /
  ...
  
  
  and the XML that results from the HTTPService send:
  
  things
thing
  nameMyName/name
  valueMyValue/value
thing
...
  things
 





[flexcoders] Re: Strange List behaviour

2007-03-07 Thread g_odds
I need the model because I use the data elsewhere as well.  I thought
the labelField property of List told it which property to use for
labels (hence my setting it to name).  I also don't think I need
another layer of properties in the List result because I should be
able to use Objects (so I can get the value property of the Object
from the List without having to do lots of silly stuff).

Graham


--- In flexcoders@yahoogroups.com, Tom Chiverton [EMAIL PROTECTED]
wrote:

 On Wednesday 07 Mar 2007, g_odds wrote:
  I am attempting to populate a List from Model filled by the result of
  an HTTPService.  However, the list only shows one entry as [object
  Object], [object Object],...  As far as I am aware that is the result
 
 Firstly, you don't need the Model tag:
 mx:List
 id=list
 dataProvider={listService.lastResult.things.things}
 labelField=name
 /
 
 Maybe you need to tell List what properties it should be using for
labels. It 
 also looks like you maybe need one extra level of properties in the
service 
 results.
 
 -- 
 Tom Chiverton
 Helping to enormously embrace ubiquitous experiences
 On: http://thefalken.livejournal.com
 
 
 
 This email is sent for and on behalf of Halliwells LLP.
 
 Halliwells LLP is a limited liability partnership registered in
England and Wales under registered number OC307980 whose registered
office address is at St James's Court Brown Street Manchester M2 2JF.
 A list of members is available for inspection at the registered
office. Any reference to a partner in relation to Halliwells LLP means
a member of Halliwells LLP. Regulated by the Law Society.
 
 CONFIDENTIALITY
 
 This email is intended only for the use of the addressee named above
and may be confidential or legally privileged.  If you are not the
addressee you must not read it and must not use any information
contained in nor copy it nor inform any person other than Halliwells
LLP or the addressee of its existence or contents.  If you have
received this email in error please delete it and notify Halliwells
LLP IT Department on 0870 365 8008.
 
 For more information about Halliwells LLP visit www.halliwells.com.





RE: [flexcoders] Re: Strange List behaviour

2007-03-07 Thread Tracy Spratt
I have never been comfortable with predicting how Model would convert my
xml, so I never use it.  Instead, use an instance variable, either typed
XML, or XMLListCollection, set resultFormat=e4x.

 

Also, I never bind directly to last result because, as you have seen, it
is difficult to debug.  Instead, use a result handler function:

Private function onResult(oEvent:ResultEvent):void {

_xmlResult:XML = XML(oEvent.result);

 trace( xmlResult.toXMLString()); //this will show you exactly what the
xml is

 _xlcThings = new XMLListCollection(xmlResult.things.thing); //bind your
list to this collection

 

Actually, I may see the problem in your code:

{listService.lastResult.things.things}

Should be:

{listService.lastResult.things.thing}

 

But still, go with xml.

 

Tracy

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of g_odds
Sent: Wednesday, March 07, 2007 12:18 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Strange List behaviour

 

I need the model because I use the data elsewhere as well. I thought
the labelField property of List told it which property to use for
labels (hence my setting it to name). I also don't think I need
another layer of properties in the List result because I should be
able to use Objects (so I can get the value property of the Object
from the List without having to do lots of silly stuff).

Graham

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, Tom Chiverton [EMAIL PROTECTED]
wrote:

 On Wednesday 07 Mar 2007, g_odds wrote:
  I am attempting to populate a List from Model filled by the result
of
  an HTTPService. However, the list only shows one entry as [object
  Object], [object Object],... As far as I am aware that is the
result
 
 Firstly, you don't need the Model tag:
 mx:List
 id=list
 dataProvider={listService.lastResult.things.things}
 labelField=name
 /
 
 Maybe you need to tell List what properties it should be using for
labels. It 
 also looks like you maybe need one extra level of properties in the
service 
 results.
 
 -- 
 Tom Chiverton
 Helping to enormously embrace ubiquitous experiences
 On: http://thefalken.livejournal.com
http://thefalken.livejournal.com 
 
 
 
 This email is sent for and on behalf of Halliwells LLP.
 
 Halliwells LLP is a limited liability partnership registered in
England and Wales under registered number OC307980 whose registered
office address is at St James's Court Brown Street Manchester M2 2JF.
A list of members is available for inspection at the registered
office. Any reference to a partner in relation to Halliwells LLP means
a member of Halliwells LLP. Regulated by the Law Society.
 
 CONFIDENTIALITY
 
 This email is intended only for the use of the addressee named above
and may be confidential or legally privileged. If you are not the
addressee you must not read it and must not use any information
contained in nor copy it nor inform any person other than Halliwells
LLP or the addressee of its existence or contents. If you have
received this email in error please delete it and notify Halliwells
LLP IT Department on 0870 365 8008.
 
 For more information about Halliwells LLP visit www.halliwells.com.


 



[flexcoders] Re: Strange List behaviour

2007-03-07 Thread Doug Lowder
It seems to me that you need to specify a property of the model as 
the list's dataprovider, instead of using the model itself.  I 
haven't tested this, but I'd be curious to see what happens if you 
try the following changes:

mx:Model id=listData
  things{listService.lastResult.things.thing}/things
/mx:Model

mx:List
id=list
dataProvider={listData.things}
labelField=name /


--- In flexcoders@yahoogroups.com, g_odds [EMAIL PROTECTED] wrote:

 I am attempting to populate a List from Model filled by the result 
of
 an HTTPService.  However, the list only shows one entry as [object
 Object], [object Object],...  As far as I am aware that is the 
result
 of a toString() on a collection.  But why is the List not using that
 collection to populate itself properly (as I want it to, hehe).
 
 Thanks in advance for any help.
 
 Graham
 
 
 The code:
 
 ...
 mx:HTTPService 
 id=listService
 url=...
 /
 mx:Model id=listData
{listService.lastResult.things.thing}
 /mx:Model
 mx:List
 id=list
 dataProvider={listData}
 labelField=name
 /
 ...
 
 
 and the XML that results from the HTTPService send:
 
 things
   thing
 nameMyName/name
 valueMyValue/value
   thing
   ...
 things