[flexcoders] Keeping DataGrid from scrolling to top on update to dataProvider

2006-08-07 Thread Chaitu Vadlapatla




Hi Jordan,
 I think i see what 
you mean. I added some changes to the code posted below. now my scroll stays at 
the previous position but throws an error when i try to scroll to the top and 
also has lots of blank rows of data. is this some sort of bug? 


public var listScrollPosition:Number = 
0;

public function 
rememberDGPosition(){listScrollPosition = 
devicesListViewGrid.verticalScrollPosition;}
public function loaded(){ 
 gateway.call( 
"DBDeviceManager.getPage5", new Responder(onResult, 
onFault),userid);}
 public function 
onResult(result:Array):void{ abcd = 
result;
 devicesListViewGrid.verticalScrollPosition = listScrollPosition 
; intervalIdList = 
setInterval(loaded, durationList);}

mx:DataGrid x="10" y="3" verticalGridLines="false" useRollOver="false" 
id="devicesListViewGrid" dataProvider="{abcd}" width="704" height="392" 
mouseDownEffect="none" selectionColor="#CDF3DD" rollOverColor="#013826" 
alternatingItemColors="[#FF,#E1F5E8]" headerColors="[#006E4F,#006E4F]" 
borderStyle="solid" horizontalGridLineColor="#BAE2CA" 
verticalGridLineColor="#BAE2CA" horizontalGridLines="true" 
borderColor="#BAE2CA" color="#FF" sortableColumns="false" 
render="rememberDGPosition()"mx:columnsmx:DataGridColumn 
width="50" id="datagridcolumn" headerText=" " 
itemRenderer="CheckCellRenderer"/mx:DataGridColumn 
headerText="NAME" dataField="name" 
itemRenderer="CheckBoxRenderer"/mx:DataGridColumn 
width="140" headerText="CURRENT STATUS" dataField="pmid" 
itemRenderer="chartPivot"/mx:DataGridColumn 
editable="false" width="90" headerText="DURATION" dataField="duration" 
itemRenderer="DurationRenderer"/mx:DataGridColumn 
editable="false" width="110" headerText="LAST CHANGE" dataField="lastchange" 
itemRenderer="lasChangeRenderer"/mx:DataGridColumn 
editable="false" width="100" headerText="PREVIOUS STATUS" 
dataField="previousstatus" 
itemRenderer="previousStateRenderer"/mx:DataGridColumn 
editable="false" headerText="GROUP" dataField="group" 
itemRenderer="groupRenderer"//mx:columns/mx:DataGrid




From: Chaitu 
VadlapatlaSent: Sun 8/6/2006 10:46 PMTo: 
[EMAIL PROTECTED]Cc: Wade ArnoldSubject: Keeping 
DataGrid from scrolling to top on update to dataProvider

Hi Jordan,
 I am very sorry to contact you off the list. But I 
am kind of desperate for a solution to the same problem that you had before with 
the datagrid not remembering the scroll position just before it was refreshed. I 
followed some of your discussion and was able to even see that if the vertical 
scroll position was set it had a set of rows which were blank. I saw your last 
post where you were able to override it with a rememberDGPosition() on the DG's 
renderer event. I am kind of lost at this point. could you please point 
tome where i am supposed to insert the "rememberDGPosition()". Could you 
please help me. I really appreciate it.


My code for the datagrid looks like this

 public function loaded(){
 gateway.call( 
"DBDeviceManager.getPage5", new Responder(onResult, 
onFault),userid);}
 public function 
onResult(result:Array):void{ abcd = 
result; intervalIdList = 
setInterval(loaded, durationList);}

mx:DataGrid x="10" y="3" verticalGridLines="false" useRollOver="false" 
id="devicesListViewGrid" dataProvider="{abcd}" width="704" height="392" 
mouseDownEffect="none" selectionColor="#CDF3DD" rollOverColor="#013826" 
alternatingItemColors="[#FF,#E1F5E8]" headerColors="[#006E4F,#006E4F]" 
borderStyle="solid" horizontalGridLineColor="#BAE2CA" 
verticalGridLineColor="#BAE2CA" horizontalGridLines="true" 
borderColor="#BAE2CA" color="#FF" 
sortableColumns="false"mx:columnsmx:DataGridColumn 
width="50" id="datagridcolumn" headerText=" " 
itemRenderer="CheckCellRenderer"/mx:DataGridColumn 
headerText="NAME" dataField="name" 
itemRenderer="CheckBoxRenderer"/mx:DataGridColumn 
width="140" headerText="CURRENT STATUS" dataField="pmid" 
itemRenderer="chartPivot"/mx:DataGridColumn 
editable="false" width="90" headerText="DURATION" dataField="duration" 
itemRenderer="DurationRenderer"/mx:DataGridColumn 
editable="false" width="110" headerText="LAST CHANGE" dataField="lastchange" 
itemRenderer="lasChangeRenderer"/mx:DataGridColumn 
editable="false" width="100" headerText="PREVIOUS STATUS" 
dataField="previousstatus" 
itemRenderer="previousStateRenderer"/mx:DataGridColumn 
editable="false" headerText="GROUP" dataField="group" 
itemRenderer="groupRenderer"//mx:columns/mx:DataGrid


---
K Everyone,I got it to work by calling the 
"rememberDGPosition()" on the DG's render event. So that worked for the 
scroll position and fixed the above bug. I can only assume that my earlier 
solution was setting the scroll position before the dataProvider registered an 
update.
__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search 

[flexcoders] Keeping DataGrid from scrolling to top on update to dataProvider

2006-06-27 Thread Jordan Snyder



Hello All,


I am working on an app in which I poll the server quite frequently to
get new information. The information comes to me in an XML format
that I simply assign as the dataProvider for a DataGrid component. 

I have to keep in consideration the fact that the user may have
selected a certain row, and may want to delete that row even after an
update to the dataProvider is made, so I keep track of the
selectedIndex property and reselect upon an update.

But if the user has not selected a row, the DataGrid will automatically
scroll to the top upon an update, even if the user has scrolled to the
bottom of the grid. 

Is there a way around this? I found a way to scrollToIndex(), but
no way of getting the currently viewed items. It may have
something to do with the various renderer properties available on the
DataGrid, but I have a very limited understanding of this, so it's over
my head.

Surely this problem has been run into before, but I can't seem to find
the right combination of search terms to figure out a method of solving
it.

Does anyone have any ideas or proven methods for the problem? Any help would be greatly appreciated.

Thank you,

Jordan Snyder
[EMAIL PROTECTED]
www.jordansnyder.com

__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



RE: [flexcoders] Keeping DataGrid from scrolling to top on update to dataProvider

2006-06-27 Thread Deepa Subramaniam










Hi Jordan 



You can keep track of the
verticalScrollPosition property in your DataGrid and upon receving UPDATES,
re-set the verticalScrollPosition to the previous value and the DataGrid will
jump to the last scroll position and show the correct content. 



-deepa











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Jordan Snyder
Sent: Monday, June 26, 2006 7:34
PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Keeping
DataGrid from scrolling to top on update to dataProvider











Hello All,

I am working on an app in which I poll the server quite frequently to get new
information. The information comes to me in an XML format that I simply
assign as the dataProvider for a DataGrid component. 

I have to keep in consideration the fact that the user may have selected a
certain row, and may want to delete that row even after an update to the
dataProvider is made, so I keep track of the selectedIndex property and
reselect upon an update.

But if the user has not selected a row, the DataGrid will automatically scroll
to the top upon an update, even if the user has scrolled to the bottom of the
grid. 

Is there a way around this? I found a way to scrollToIndex(), but no way
of getting the currently viewed items. It may have something to do with
the various renderer properties available on the DataGrid, but I have a very
limited understanding of this, so it's over my head.

Surely this problem has been run into before, but I can't seem to find the
right combination of search terms to figure out a method of solving it.

Does anyone have any ideas or proven methods for the problem? Any help
would be greatly appreciated.

Thank you,

Jordan Snyder
[EMAIL PROTECTED]
www.jordansnyder.com






__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___