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="[#FFFFFF,#E1F5E8]" headerColors="[#006E4F,#006E4F]" borderStyle="solid" horizontalGridLineColor="#BAE2CA" verticalGridLineColor="#BAE2CA" horizontalGridLines="true"  borderColor="#BAE2CA" color="#FFFFFF" sortableColumns="false"
render="rememberDGPosition()" >
 
     <mx:columns>
     <mx: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 Vadlapatla
Sent: Sun 8/6/2006 10:46 PM
To: [EMAIL PROTECTED]
Cc: Wade Arnold
Subject: 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 to me 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="[#FFFFFF,#E1F5E8]" headerColors="[#006E4F,#006E4F]" borderStyle="solid" horizontalGridLineColor="#BAE2CA" verticalGridLineColor="#BAE2CA" horizontalGridLines="true"  borderColor="#BAE2CA" color="#FFFFFF" sortableColumns="false" >
 
     <mx:columns>
     <mx: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>
 
 
-------------------------------------------------------------------------------------------------------
MMMMK 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 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




__,_._,___

Reply via email to