PDA

View Full Version : DataGrid highlight disappears when row UI changes


Crunchy Cat
05-24-2007, 07:34 PM
Hello,

I just started using Flex and I found an odd behavior which I am not quite sure how to go about solving (mainly becuase I am not sure why it happens).

My datagrid is populated via an XMLList object, and the data asynchronsly changes over time. I have a progress bar in every row that is updated as the data changes (it's listening to a TextInput which in turn is bound directly to XML data). Everytime a progressbar updates then the rollOver highlight for whatever row the mouse is over simply vanishes... never to return until I move the mouse to another row.

I was able to reproduce the same behavior by stuffing an image and zoom control into a grid container which in turn was added to a datgrid row. Specifically, I set the zoom control to expand and contract the image when the mouse rolled over and out of the grid container. Everytime a zoom happens, the rollOver highlight for the current row vanishes and of course is only restored by moving to another row.

Why does this happen and how to I preserve the row highlight?

Thanks!

Crunchy Cat
05-25-2007, 09:33 PM
No ideas or suggestions? Anybody? Maybe my description is too complex. If I were to simplify it then I would say:

* It appears that any asynchronous rendering to custom controls in a datagrid cell makes the current rollOver row highlight disappear.

So why does this happen and how can I keep the rollover highlight?

Crunchy Cat
05-28-2007, 08:48 AM
I can hear the crickets... surely somebody has run into this?

barbisio
12-04-2009, 05:14 PM
Hi...
Same problem!
I have a datagrid that is filled with an arraylist coming from an XML file generated on the server.
There is a timer that every 3 secs reload the XML data.
I have a scroll position function setup but when I move with the vertical scrollbar to a point the scroll bar position is kept but if the last datagrid row is not totally visible it goes away.
I have used he ValidateNow() but... no way.
here is the code:

[Bindable]
private var BSArray:ArrayCollection;
private var lastScroll:Number = 0;

private function resultHandler2(evt:ResultEvent):void{
BSArray = evt.result.Comments.Comment;
dgBSComments.validateNow();
dgBSComments.verticalScrollPosition = lastScroll;
}
private function faultHandler2(evt:FaultEvent):void{
mx.controls.Alert.show("Server connection not available")
}

//timer
private const TIMER_INTERVAL:int = 3000;
private var baseTimer:int;
private var t:Timer;
private function init():void {
t = new Timer(TIMER_INTERVAL);
t.addEventListener(TimerEvent.TIMER, updateTimer);
}
private function updateTimer(evt:TimerEvent):void {
lastScroll = dgBSComments.verticalScrollPosition;
loadBS.send();
}
private function startTimer():void {
baseTimer = getTimer();
t.start();
}
private function stopTimer():void {
t.stop();
}

<mx:HTTPService id="insBS" url="{lblPath.text}BSComInsXML.aspx" method="POST"
showBusyCursor="true"
result="resultHandler3(event)"
fault="faultHandler3(event)"
resultFormat="object" >
<mx:request xmlns="">
<IDBox>{lblBoxID.text}</IDBox>
<IDBS>{lblBSID.text}</IDBS>
<User>{txtUser.text}</User>
<IsApp>{lblApp.text}</IsApp>
<Comment>{txtComment.text}</Comment>
</mx:request>
</mx:HTTPService>
<mx:DataGrid
x="10" y="150"
width="492" height="275"
id="dgBSComments"
wordWrap="true"
itemClick="appendComment(event);"
selectable="false"
variableRowHeight="true"
showHeaders="false"
dataProvider="{BSArray}"
>
<mx:columns>
<mx:DataGridColumn headerText="" width="15" >
<mx:itemRenderer>
<mx:Component>
<mx:HBox horizontalAlign="center" width="15" toolTip="{data.BtnToltip}" >
<mx:SWFLoader source="../images/btnApp.swf" visible="{data.AppBtn}" />
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="Posted" width="60" >
<mx:itemRenderer>
<mx:Component>
<mx:Text text="{data.Date}" color="{data.TextColor}" />
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="User" width="80">
<mx:itemRenderer>
<mx:Component>
<mx:Text text="{data.User}" color="{data.TextColor}" />
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="Comment" width="300" >
<mx:itemRenderer>
<mx:Component>
<mx:Text text="{data.Com}" color="{data.TextColor}" />
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>