<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Another Flex Weirdness/Gotcha</title>
	<atom:link href="http://www.barneyb.com/barneyblog/2007/06/23/another-flex-weirdnessgotcha/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.barneyb.com/barneyblog/2007/06/23/another-flex-weirdnessgotcha/</link>
	<description>Thoughts, rants, and even some code from the mind of Barney Boisvert.</description>
	<lastBuildDate>Thu, 11 Sep 2014 09:58:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: wellings.eu &#187; Updating a datagrid dataprovider with custom item renderer not working as expected?</title>
		<link>https://www.barneyb.com/barneyblog/2007/06/23/another-flex-weirdnessgotcha/comment-page-1/#comment-229890</link>
		<dc:creator>wellings.eu &#187; Updating a datagrid dataprovider with custom item renderer not working as expected?</dc:creator>
		<pubDate>Tue, 07 Dec 2010 20:10:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/2007/06/23/another-flex-weirdnessgotcha/#comment-229890</guid>
		<description>[...] http://www.barneyb.com/barneyblog/2007/06/23/another-flex-weirdnessgotcha/   About    Visit &#039;s Website. View other posts by [...]</description>
		<content:encoded><![CDATA[<p>[...] <a href="http://www.barneyb.com/barneyblog/2007/06/23/another-flex-weirdnessgotcha/" rel="nofollow">http://www.barneyb.com/barneyblog/2007/06/23/another-flex-weirdnessgotcha/</a>   About    Visit &#39;s Website. View other posts by [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Lincoln</title>
		<link>https://www.barneyb.com/barneyblog/2007/06/23/another-flex-weirdnessgotcha/comment-page-1/#comment-222019</link>
		<dc:creator>David Lincoln</dc:creator>
		<pubDate>Mon, 04 Oct 2010 12:33:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/2007/06/23/another-flex-weirdnessgotcha/#comment-222019</guid>
		<description>I have a similar weirdness. The ArrayCollection. refresh() works as expected. But it has a side effect. If the number of rows in my datagrid exceeds the capability of the window it is in, (vertical scroll bars are needed), then when I click in a row after the first couple, the screen refreshes automatically and scrolls up past the row I clicked on. I have tried capturing the verticalSrollPosition of the datagrid prior to the refresh, then resetting it afterward, but that does not help. It&#039;s like a catch-22.  Either the cell does not refresh properly and the scroll works fine, or vice-versa.</description>
		<content:encoded><![CDATA[<p>I have a similar weirdness. The ArrayCollection. refresh() works as expected. But it has a side effect. If the number of rows in my datagrid exceeds the capability of the window it is in, (vertical scroll bars are needed), then when I click in a row after the first couple, the screen refreshes automatically and scrolls up past the row I clicked on. I have tried capturing the verticalSrollPosition of the datagrid prior to the refresh, then resetting it afterward, but that does not help. It's like a catch-22.  Either the cell does not refresh properly and the scroll works fine, or vice-versa.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BS_C3</title>
		<link>https://www.barneyb.com/barneyblog/2007/06/23/another-flex-weirdnessgotcha/comment-page-1/#comment-208870</link>
		<dc:creator>BS_C3</dc:creator>
		<pubDate>Sun, 21 Mar 2010 12:28:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/2007/06/23/another-flex-weirdnessgotcha/#comment-208870</guid>
		<description>Hi!

That&#039;s a really interesting post (it actually helped me solve a problem that was driving me crazy!!). 

I had the same issue with a linkbar. The dataprovider was an array collection that looked like 

    
    &lt;Object label =
    .
    .
    .

The labels where not updated when the variables value changed... I had to force a dataprovider.refresh() to get it work. It took me some time and some posts to figure it out.

The most interesting thing is that this &quot;weirdness&quot; still exists in flex 3.2 ...

And just FYI, a quite useful link about dataproviders limitations:
http://www.adobe.com/devnet/flex/quickstart/using_data_providers/#limitations

Regards,
BS_C3</description>
		<content:encoded><![CDATA[<p>Hi!</p>
<p>That's a really interesting post (it actually helped me solve a problem that was driving me crazy!!). </p>
<p>I had the same issue with a linkbar. The dataprovider was an array collection that looked like </p>
<p>    &lt;Object label =<br />
    .<br />
    .<br />
    .</p>
<p>The labels where not updated when the variables value changed&#8230; I had to force a dataprovider.refresh() to get it work. It took me some time and some posts to figure it out.</p>
<p>The most interesting thing is that this "weirdness" still exists in flex 3.2 &#8230;</p>
<p>And just FYI, a quite useful link about dataproviders limitations:<br />
<a href="http://www.adobe.com/devnet/flex/quickstart/using_data_providers/#limitations" rel="nofollow">http://www.adobe.com/devnet/flex/quickstart/using_data_providers/#limitations</a></p>
<p>Regards,<br />
BS_C3</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon</title>
		<link>https://www.barneyb.com/barneyblog/2007/06/23/another-flex-weirdnessgotcha/comment-page-1/#comment-202541</link>
		<dc:creator>Jon</dc:creator>
		<pubDate>Sun, 17 Jan 2010 01:45:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/2007/06/23/another-flex-weirdnessgotcha/#comment-202541</guid>
		<description>Gotta say thanks for this....was driving me crazy.

ArrayCollection(dataGrid.dataProvider).refresh(); worked perfectly for me.</description>
		<content:encoded><![CDATA[<p>Gotta say thanks for this&#8230;.was driving me crazy.</p>
<p>ArrayCollection(dataGrid.dataProvider).refresh(); worked perfectly for me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dylan</title>
		<link>https://www.barneyb.com/barneyblog/2007/06/23/another-flex-weirdnessgotcha/comment-page-1/#comment-192268</link>
		<dc:creator>Dylan</dc:creator>
		<pubDate>Wed, 30 Sep 2009 01:16:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/2007/06/23/another-flex-weirdnessgotcha/#comment-192268</guid>
		<description>I was having a similar problem using a repeater with a custom component that has a nested second repeater.  Repeater A was registering updates to the Bindable object just fine but Repeater B was not updating itself even though the ArrayCollection B it was using as a dataSource had changed. 

I tried invalidating the components housing the repeaters but that did not work.  I finally took a stab at useing the arrayCollection.refresh() and it worked like magic.  Note: everything is [Bindable], it just another one of those quirks.</description>
		<content:encoded><![CDATA[<p>I was having a similar problem using a repeater with a custom component that has a nested second repeater.  Repeater A was registering updates to the Bindable object just fine but Repeater B was not updating itself even though the ArrayCollection B it was using as a dataSource had changed. </p>
<p>I tried invalidating the components housing the repeaters but that did not work.  I finally took a stab at useing the arrayCollection.refresh() and it worked like magic.  Note: everything is [Bindable], it just another one of those quirks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vitaly Sazanovich</title>
		<link>https://www.barneyb.com/barneyblog/2007/06/23/another-flex-weirdnessgotcha/comment-page-1/#comment-189227</link>
		<dc:creator>Vitaly Sazanovich</dc:creator>
		<pubDate>Thu, 20 Aug 2009 23:05:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/2007/06/23/another-flex-weirdnessgotcha/#comment-189227</guid>
		<description>I also had a similar problem. My DataGrid would update its content only when the popup was opened for the first time. I debugged this into a stale reference to the old instance of the DataGrid. I&#039;m using PureMVC and in the constructor of the mediator for the Popup I was registering mediators for canvases within that popup:
facade.registerMediator(new AdPlacesCanvasMediator(settingsTitleWindow.adPlacesCanvas));
Now, the fix was to unregister them in the onClose event:
facade.removeMediator(AdPlacesCanvasMediator.NAME);
Otherwise a new set of mediators would be created with the next popup. Is it a bug of PureMVC? RegisterMediator should take mediator&#039;s name as a parameter and do not create a new instance of the mediator if it is already registered.</description>
		<content:encoded><![CDATA[<p>I also had a similar problem. My DataGrid would update its content only when the popup was opened for the first time. I debugged this into a stale reference to the old instance of the DataGrid. I'm using PureMVC and in the constructor of the mediator for the Popup I was registering mediators for canvases within that popup:<br />
facade.registerMediator(new AdPlacesCanvasMediator(settingsTitleWindow.adPlacesCanvas));<br />
Now, the fix was to unregister them in the onClose event:<br />
facade.removeMediator(AdPlacesCanvasMediator.NAME);<br />
Otherwise a new set of mediators would be created with the next popup. Is it a bug of PureMVC? RegisterMediator should take mediator's name as a parameter and do not create a new instance of the mediator if it is already registered.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Terry</title>
		<link>https://www.barneyb.com/barneyblog/2007/06/23/another-flex-weirdnessgotcha/comment-page-1/#comment-187582</link>
		<dc:creator>Terry</dc:creator>
		<pubDate>Wed, 05 Aug 2009 19:12:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/2007/06/23/another-flex-weirdnessgotcha/#comment-187582</guid>
		<description>I had a similar problem.  In the snippet below dataObjects is an ArrayCollection that was set as my dataProvider on my AdvancedDataGrid.  I could not get updates to refresh until I added the last line.

public function changeData(event:MouseEvent):void {
   var data:Array = dataObjects.getItemAt(2) as Array;
   data[1] = &quot;pmWizard&quot;;
		
   data = dataObjects.getItemAt(1) as Array;
   data[1] = &quot;treeKing&quot;;
   data[4] = 1967;

   ArrayCollection(dataGrid.dataProvider).refresh();
}</description>
		<content:encoded><![CDATA[<p>I had a similar problem.  In the snippet below dataObjects is an ArrayCollection that was set as my dataProvider on my AdvancedDataGrid.  I could not get updates to refresh until I added the last line.</p>
<p>public function changeData(event:MouseEvent):void {<br />
   var data:Array = dataObjects.getItemAt(2) as Array;<br />
   data[1] = "pmWizard";</p>
<p>   data = dataObjects.getItemAt(1) as Array;<br />
   data[1] = "treeKing";<br />
   data[4] = 1967;</p>
<p>   ArrayCollection(dataGrid.dataProvider).refresh();<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Garnet</title>
		<link>https://www.barneyb.com/barneyblog/2007/06/23/another-flex-weirdnessgotcha/comment-page-1/#comment-111461</link>
		<dc:creator>Garnet</dc:creator>
		<pubDate>Thu, 31 Jul 2008 23:49:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/2007/06/23/another-flex-weirdnessgotcha/#comment-111461</guid>
		<description>I agree about weirdness. It&#039;s easy to do cool stuff in Flex quickly, but then you run into a quirk that takes way too long to solve. 

I have this as the data provider for my AdvancedDataGrid: 
        private var dpList:ArrayCollection = new ArrayCollection([
              {Ref:true, Name:&quot;Garnet&quot;, 
                  ReadTime:400}]);

In timer routines I want to 
   dpList[0].ReadTime++

But the grid won&#039;t update. I tried all of these, and none of them work to cause an update:
              dpList.refresh();
              adgList.validateNow();
              adgList.executeBindings(false);
 
The one thing that does work is doing 
              dpList.addItem(...)

Guess I need to trace into the source for addItem and figure out what it is doing.</description>
		<content:encoded><![CDATA[<p>I agree about weirdness. It's easy to do cool stuff in Flex quickly, but then you run into a quirk that takes way too long to solve. </p>
<p>I have this as the data provider for my AdvancedDataGrid:<br />
        private var dpList:ArrayCollection = new ArrayCollection([<br />
              {Ref:true, Name:"Garnet",<br />
                  ReadTime:400}]);</p>
<p>In timer routines I want to<br />
   dpList[0].ReadTime++</p>
<p>But the grid won't update. I tried all of these, and none of them work to cause an update:<br />
              dpList.refresh();<br />
              adgList.validateNow();<br />
              adgList.executeBindings(false);</p>
<p>The one thing that does work is doing<br />
              dpList.addItem(&#8230;)</p>
<p>Guess I need to trace into the source for addItem and figure out what it is doing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: William Henry</title>
		<link>https://www.barneyb.com/barneyblog/2007/06/23/another-flex-weirdnessgotcha/comment-page-1/#comment-70915</link>
		<dc:creator>William Henry</dc:creator>
		<pubDate>Thu, 03 Apr 2008 23:01:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/2007/06/23/another-flex-weirdnessgotcha/#comment-70915</guid>
		<description>You can use myDataGrid.executeBindings(false);
The argument determines whether there is recursion.</description>
		<content:encoded><![CDATA[<p>You can use myDataGrid.executeBindings(false);<br />
The argument determines whether there is recursion.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: barneyb</title>
		<link>https://www.barneyb.com/barneyblog/2007/06/23/another-flex-weirdnessgotcha/comment-page-1/#comment-22227</link>
		<dc:creator>barneyb</dc:creator>
		<pubDate>Sun, 24 Jun 2007 16:07:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/2007/06/23/another-flex-weirdnessgotcha/#comment-22227</guid>
		<description>Thanks for the comments.  I&#039;m aware of how to make it work, I&#039;m just surprised it doesn&#039;t work by default.  I.e. there aren&#039;t per-property watchers, just per-object watchers.  Refreshing the provider, reexecuting bindings, putting ChangeWatchers on the properties manually, etc., would al work, but it just seems weird to have to do that manually.

I haven&#039;t tried it, but I&#039;d be willing to bet that a custom itemRenderer that manually binds itself to the specific property (but is otherwise a &quot;normal&quot; renderer) would fix the issue.  Then you could just use that in all your DataGrids and have it taken care of &quot;automatically&quot;.</description>
		<content:encoded><![CDATA[<p>Thanks for the comments.  I'm aware of how to make it work, I'm just surprised it doesn't work by default.  I.e. there aren't per-property watchers, just per-object watchers.  Refreshing the provider, reexecuting bindings, putting ChangeWatchers on the properties manually, etc., would al work, but it just seems weird to have to do that manually.</p>
<p>I haven't tried it, but I'd be willing to bet that a custom itemRenderer that manually binds itself to the specific property (but is otherwise a "normal" renderer) would fix the issue.  Then you could just use that in all your DataGrids and have it taken care of "automatically".</p>
]]></content:encoded>
	</item>
</channel>
</rss>
