RE: [SPAM] [flexcoders] Re: Custom ItemRenderer still not working...

2010-02-09 Thread Tracy Spratt
You said, "I scroll up and down, and the selected value in the ComboBox does
NOT change, but the values in the drop-down DO change"

 

So I have been trying to solve the wrong problem.  The problem is that the
combo box dataProvider is not updating correctly when you scroll, is that
correct?

 

Did you try directly assigning the dataProvider instead of binding as I
suggested earlier?

 

Yes, use commitProperties.  Find an example, mine on www.cflex.net
  is one, there are many others.

 

 

Tracy Spratt,

Lariat Services, development services available

  _  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Laurence
Sent: Monday, February 08, 2010 8:44 AM
To: flexcoders@yahoogroups.com
Subject: [SPAM] [flexcoders] Re: Custom ItemRenderer still not working...

 

  

--- In flexcod...@yahoogro  ups.com,
"Tracy Spratt"  wrote:
>
> Post it here, the more eyes that look at it the better for you.
> 

Know an easy way to export my SQL data as something I can post here?
Something like an SQL to XML conversion, so I can include the data in a text
file that the test-program can read?

> Your DataGrid is not editable, correct? And your render is not set
> as an editor, right?

The data grid IS editable, and one of the columns has renderer-as-editor
set. NOT the column that's giving me the trouble. In fact all the columns
have editable set to false, except one column -- again, NOT the one that's
giving me trouble.

> I assume you have debugged this and have tested to see that the
> dataProvider is set when you set selectedItem? Maybe there is a
> timing issue with the bound dataProvider. Loop over the items to
> make sure the item exists. And make sure it matches the
> selectedIndex. I'd probably suggest you do this any way and use
> selectedItem always.
> 
> I would use a conditional, testing for the selectedItem, rather
> than blindly setting selectedIndex every time.

Not 100% certain what you mean here... Check to see if the selectedItem
isn't null? The problem I'm having is not that the selectedItem changes (or
appears to change) when you scroll. It's solely in the drop-down. The data
that appears in the drop-down will change from time-to-time as you scroll --
but the selected value doesn't change ever, unless you change it manually.
And when you do change it manually, it shows the value it's supposed to
show! Then you re-open the drop-down and THAT show's the correct values,
too! That's what's so weird about this problem.

> Finally, I strongly suggest you move that work into
> commitProperties() The set data() function gets called much more
> often than you may realize.

I've never used the commitProperties() function... What does it do? And when
does it get called? Would that work 100% of the time? Basically you're
telling me to do "super.data = value" in the "set data()" function, then
populate the drop-down and selectedItem stuff in the commitProperties()
function? Is that what you're saying?

I'll be working on writing a test-case -- the biggest part of it seems to be
exporting my data. I can't find a shortcut to doing that. But if you can
answer my above questions, then maybe I won't have to write the test-case?

Anyway, thanks a bunch!
Laurence MacNeill
Mableton, Georgia, USA





RE: [SPAM] [flexcoders] Re: Custom ItemRenderer still not working...

2010-02-07 Thread Tracy Spratt
If I am understanding your problem, Array should be fine.  The problem with
array is when you update elements.  The change events should get fired when
the entire array is replaced.  Besides, it sounds like the list part is
working correctly.

 

Tracy Spratt,

Lariat Services, development services available

  _  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Laurence
Sent: Friday, February 05, 2010 3:20 PM
To: flexcoders@yahoogroups.com
Subject: [SPAM] [flexcoders] Re: Custom ItemRenderer still not working...

 

  

Well, hmmm... I can't rewrite it so data.course_fees is an ArrayCollection
-- when I change the 'EventVO.as' such that course_fees is an
ArrayCollection instead of an Array, it comes back from the database as
null... Perhaps that's a problem with my CF code (EventVO.cfc and
EventDAO.cfc)? How do you get CF to send data back as an ArrayCollection
instead of an Array? I'm thinking that's not possible...

If I leave the EventVO.as alone, and course_fees is an Array, then I still
have the same problem in my ItemRenderer -- doesn't seem to matter if I make
listOfFees an Array or ArrayCollection...

--- In flexcod...@yahoogro  ups.com,
"Laurence"  wrote:
>
> Hmmm... That's an idea... data.course_fees is coming out of the database
as an Array -- perhaps I should rewrite that so it comes out as an
ArrayCollection from the very beginning... I'll give that a shot... (Yes, I
know I can put an Array into an ArrayCollection, but if Array isn't behaving
properly, I shouldn't use it at all, right?)
> 
> If I were to do something like:
> listOfFees:ArrayCollection = new ArrayCollection(data.course_fees);
> would that pass a reference to the ArrayCollection, or will that be making
a copy?
> 
> --- In flexcod...@yahoogro  ups.com,
"wrhinfl"  wrote:
> >
> > I thought array does not broadcast updates "nicely" (uniformly/as
expected), can you change the declaration of listOfFees from:
> > [Bindable]private var listOfFees:Array;
> > to:[Bindable]private var listOfFees:ArrayCollection;
> >
>





RE: [SPAM] [flexcoders] Re: Custom ItemRenderer still not working...

2010-02-07 Thread Tracy Spratt
Post it here, the more eyes that look at it the better for you.

 

Your DataGrid is not editable, correct?  And your render is not set as an
editor, right?

 

I assume you have debugged this and have tested to see that the dataProvider
is set when you set selectedItem?  Maybe there is a timing issue with the
bound dataProvider. Loop over the items to make sure the item exists.  And
make sure it matches the selectedIndex.  I'd probably suggest you do this
any way and use selectedItem always.

 

I would use a conditional, testing for the selectedItem, rather than blindly
setting selectedIndex every time.

 

Finally, I strongly suggest you move that work into commitProperties() The
set data() function gets called much more often than you may realize.

 

Tracy Spratt,

Lariat Services, development services available

  _  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Laurence
Sent: Sunday, February 07, 2010 6:19 AM
To: flexcoders@yahoogroups.com
Subject: [SPAM] [flexcoders] Re: Custom ItemRenderer still not working...

 

  

--- In flexcod...@yahoogro  ups.com,
Alex Harui  wrote:
>
> Maybe Tracy can figure it out from just the renderer code, but I
> think I need a complete (but small) test case with some sample data.

Can I send it to you via this list? Or do I have to e-mail you privately
somehow? Just let me know where to send it, and I'll put together a small
test-case for ya sometime in the next couple of days.

> 
> The only thing I see that looks unusual (besides calling refrehs()
> is setting both selectedItem and selectedIndex. One should be good
> enough.

Yeah, one should be good enough, I agree... If you notice, however, that I
set selectedItem first, then selectedIndex. There are times (rare, but it
happens) when the database has been corrupted or accidentally changed, and
none of the items match in the selectedItem list. The boss wants it to
default, in that case, to whatever is returned by selectedIndex. Kind of an
auto-repair for his database. LOL

Thanks,
Laurence MacNeill
Mableton, Georgia, USA





RE: [SPAM] [flexcoders] Re: Custom ItemRenderer still not working...

2010-02-06 Thread Tracy Spratt
Refresh() is intended to re-apply a sort of filter to a collection.  If it
is working in your case it is a side effect.

 

I couldn't find your previous post to look at the code, but I still suspect
recycling issues.  For a combo box, you have to do two actions on set data
(actually  in commitProperties, of course).  You must re-assign to
dataProvider, and you must set the selectedIndex (you can only use
selectedItem if your items are simple strings or numbers).  Are you doing
both of those things?

 

I have an example on cflex.  It is more complex than necessary because I
wanted it to be generic:

http://www.cflex.net/showFileDetails.cfm?ObjectID=767

 

Tracy Spratt,

Lariat Services, development services available

  _  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Laurence
Sent: Saturday, February 06, 2010 4:29 AM
To: flexcoders@yahoogroups.com
Subject: [SPAM] [flexcoders] Re: Custom ItemRenderer still not working...

 

  

Well, I found a work-around...

I added the following code inside my ComboBox ItemRenderer:
override protected function focusInHandler(event:FocusEvent):void {
listOfFees.refresh();
}

For some reason, with this in there, you have to double-click on the combo
box to open it, but the drop-down shows the correct data 100% of the time.
Good enough for now.



--- In flexcod...@yahoogro  ups.com,
"Laurence"  wrote:
>
> Well, I installed FlashBuilder 4 Premium Beta 2, imported the project into
there, and ran the code.
> 
> It is EXACTLY THE SAME in FB3 and FB4 -- the exact same problem appears. I
scroll down in the DataGrid, and the numbers in the ItemRenderer's drop down
change (but not the selected number being displayed.) If I select one of the
incorrect numbers, the drop-down immedately changes to the correct numbers,
and the number I would've selected (had it been displayed correctly) shows
as the selected item in the combo box. It's just SO WEIRD!
> 
> So... What is that problem, exactly? Anyone able to figure it out? I'm
totally confused... It should be working! (See my earlier post for the code
-- I beg you, PLEASE help me figure this out!)
> 
> Thanks,
> Laurence MacNeill
> Mableton, Georgia, USA
> 
> 
> 
> --- In flexcod...@yahoogro  ups.com,
"Laurence"  wrote:
> >
> > 
> > 
> > --- In flexcod...@yahoogro 
ups.com, Alex Harui  wrote:
> > >
> > > I didn't take the time to debug your code, just looked for the usual
suspects and didn't see any. It was supposed to be fixed in 3.5 but somehow
got busted so now will be in 3.6 but not sure when that ships.
> > > 
> > > I didn't really want you to port the whole project, just write a test
case with Flex 4 to see if you are hitting that same problem, then we can
figure out what to do from there.
> > 
> > I will try that if the Array vs. ArrayCollection idea doesn't pan out...
Hate to go through all the trouble of installing Flex 4 Beta just for this,
though... Or can I just install the 4.0 SDK in my existing FlexBuilder Pro?
> >
>