主頁 > 知識(shí)庫 > Flex中怎么給表格中的滾動(dòng)條定位避免刷新回到原處

Flex中怎么給表格中的滾動(dòng)條定位避免刷新回到原處

熱門標(biāo)簽:廣州ai外呼系統(tǒng)業(yè)務(wù) 什么行業(yè)需要電話機(jī)器人 地圖標(biāo)注多家店 南昌crm外呼系統(tǒng)如何 車載電話機(jī)器人 外呼系統(tǒng)號(hào)碼顯示 天津企業(yè)外呼系統(tǒng)代理商 無錫電銷外呼系統(tǒng)代理 中山外呼系統(tǒng)中間件

1、問題背景

如果表格中的字段過多,會(huì)出現(xiàn)滾動(dòng)條,在將滾動(dòng)條滾到一定的位置時(shí),重新刷新表格,滾動(dòng)條會(huì)回到原處,原來查看的字段還得繼續(xù)滾動(dòng),才能查看到。

2、實(shí)現(xiàn)實(shí)例

?xml version="1.0" encoding="utf-8"?> 
s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
xmlns:s="library://ns.adobe.com/flex/spark" 
xmlns:mx="library://ns.adobe.com/flex/mx" 
creationComplete="initHandler(event)" 
width="100%" height="100%"> 
s:layout> 
s:BasicLayout/> 
/s:layout> 
fx:Script> 
![CDATA[ 
import mx.collections.ArrayCollection; 
import mx.controls.Alert; 
import mx.events.FlexEvent; 

[Bindable] 
//表格數(shù)據(jù)綁定 
private var gridArray:ArrayCollection = new ArrayCollection([ 
{Jan:"5678",Feb:"7890",Mar:"3454",Apr:"4565",May:"6756",Jun:"5656",Jul:"7867",Aug:"8990",Sep:"5676",Oct:"4655",Nov:"6778",Dec:"8909", 
Jan1:"3344",Feb1:"5676",Mar1:"7898",Apr1:"9089",May1:"9009",Jun1:"5675",Jul1:"3433",Aug1:"4455",Sep1:"6676",Oct1:"7867",Nov1:"4556",Dec1:"8656"}, 
{Jan:"5678",Feb:"7890",Mar:"3454",Apr:"4565",May:"6756",Jun:"5656",Jul:"7867",Aug:"8990",Sep:"5676",Oct:"4655",Nov:"6778",Dec:"8909", 
Jan1:"3344",Feb1:"5676",Mar1:"7898",Apr1:"9089",May1:"9009",Jun1:"5675",Jul1:"3433",Aug1:"4455",Sep1:"6676",Oct1:"7867",Nov1:"4556",Dec1:"8656"}, 
{Jan:"5678",Feb:"7890",Mar:"3454",Apr:"4565",May:"6756",Jun:"5656",Jul:"7867",Aug:"8990",Sep:"5676",Oct:"4655",Nov:"6778",Dec:"8909", 
Jan1:"3344",Feb1:"5676",Mar1:"7898",Apr1:"9089",May1:"9009",Jun1:"5675",Jul1:"3433",Aug1:"4455",Sep1:"6676",Oct1:"7867",Nov1:"4556",Dec1:"8656"}, 
{Jan:"5678",Feb:"7890",Mar:"3454",Apr:"4565",May:"6756",Jun:"5656",Jul:"7867",Aug:"8990",Sep:"5676",Oct:"4655",Nov:"6778",Dec:"8909", 
Jan1:"3344",Feb1:"5676",Mar1:"7898",Apr1:"9089",May1:"9009",Jun1:"5675",Jul1:"3433",Aug1:"4455",Sep1:"6676",Oct1:"7867",Nov1:"4556",Dec1:"8656"}, 
{Jan:"5678",Feb:"7890",Mar:"3454",Apr:"4565",May:"6756",Jun:"5656",Jul:"7867",Aug:"8990",Sep:"5676",Oct:"4655",Nov:"6778",Dec:"8909", 
Jan1:"3344",Feb1:"5676",Mar1:"7898",Apr1:"9089",May1:"9009",Jun1:"5675",Jul1:"3433",Aug1:"4455",Sep1:"6676",Oct1:"7867",Nov1:"4556",Dec1:"8656"}, 
{Jan:"5678",Feb:"7890",Mar:"3454",Apr:"4565",May:"6756",Jun:"5656",Jul:"7867",Aug:"8990",Sep:"5676",Oct:"4655",Nov:"6778",Dec:"8909", 
Jan1:"3344",Feb1:"5676",Mar1:"7898",Apr1:"9089",May1:"9009",Jun1:"5675",Jul1:"3433",Aug1:"4455",Sep1:"6676",Oct1:"7867",Nov1:"4556",Dec1:"8656"}, 
{Jan:"5678",Feb:"7890",Mar:"3454",Apr:"4565",May:"6756",Jun:"5656",Jul:"7867",Aug:"8990",Sep:"5676",Oct:"4655",Nov:"6778",Dec:"8909", 
Jan1:"3344",Feb1:"5676",Mar1:"7898",Apr1:"9089",May1:"9009",Jun1:"5675",Jul1:"3433",Aug1:"4455",Sep1:"6676",Oct1:"7867",Nov1:"4556",Dec1:"8656"}, 
{Jan:"5678",Feb:"7890",Mar:"3454",Apr:"4565",May:"6756",Jun:"5656",Jul:"7867",Aug:"8990",Sep:"5676",Oct:"4655",Nov:"6778",Dec:"8909", 
Jan1:"3344",Feb1:"5676",Mar1:"7898",Apr1:"9089",May1:"9009",Jun1:"5675",Jul1:"3433",Aug1:"4455",Sep1:"6676",Oct1:"7867",Nov1:"4556",Dec1:"8656"}, 
{Jan:"5678",Feb:"7890",Mar:"3454",Apr:"4565",May:"6756",Jun:"5656",Jul:"7867",Aug:"8990",Sep:"5676",Oct:"4655",Nov:"6778",Dec:"8909", 
Jan1:"3344",Feb1:"5676",Mar1:"7898",Apr1:"9089",May1:"9009",Jun1:"5675",Jul1:"3433",Aug1:"4455",Sep1:"6676",Oct1:"7867",Nov1:"4556",Dec1:"8656"}, 
{Jan:"5678",Feb:"7890",Mar:"3454",Apr:"4565",May:"6756",Jun:"5656",Jul:"7867",Aug:"8990",Sep:"5676",Oct:"4655",Nov:"6778",Dec:"8909", 
Jan1:"3344",Feb1:"5676",Mar1:"7898",Apr1:"9089",May1:"9009",Jun1:"5675",Jul1:"3433",Aug1:"4455",Sep1:"6676",Oct1:"7867",Nov1:"4556",Dec1:"8656"}, 
{Jan:"5678",Feb:"7890",Mar:"3454",Apr:"4565",May:"6756",Jun:"5656",Jul:"7867",Aug:"8990",Sep:"5676",Oct:"4655",Nov:"6778",Dec:"8909", 
Jan1:"3344",Feb1:"5676",Mar1:"7898",Apr1:"9089",May1:"9009",Jun1:"5675",Jul1:"3433",Aug1:"4455",Sep1:"6676",Oct1:"7867",Nov1:"4556",Dec1:"8656"}, 
{Jan:"5678",Feb:"7890",Mar:"3454",Apr:"4565",May:"6756",Jun:"5656",Jul:"7867",Aug:"8990",Sep:"5676",Oct:"4655",Nov:"6778",Dec:"8909", 
Jan1:"3344",Feb1:"5676",Mar1:"7898",Apr1:"9089",May1:"9009",Jun1:"5675",Jul1:"3433",Aug1:"4455",Sep1:"6676",Oct1:"7867",Nov1:"4556",Dec1:"8656"}, 
{Jan:"5678",Feb:"7890",Mar:"3454",Apr:"4565",May:"6756",Jun:"5656",Jul:"7867",Aug:"8990",Sep:"5676",Oct:"4655",Nov:"6778",Dec:"8909", 
Jan1:"3344",Feb1:"5676",Mar1:"7898",Apr1:"9089",May1:"9009",Jun1:"5675",Jul1:"3433",Aug1:"4455",Sep1:"6676",Oct1:"7867",Nov1:"4556",Dec1:"8656"}, 
{Jan:"5678",Feb:"7890",Mar:"3454",Apr:"4565",May:"6756",Jun:"5656",Jul:"7867",Aug:"8990",Sep:"5676",Oct:"4655",Nov:"6778",Dec:"8909", 
Jan1:"3344",Feb1:"5676",Mar1:"7898",Apr1:"9089",May1:"9009",Jun1:"5675",Jul1:"3433",Aug1:"4455",Sep1:"6676",Oct1:"7867",Nov1:"4556",Dec1:"8656"}, 
{Jan:"5678",Feb:"7890",Mar:"3454",Apr:"4565",May:"6756",Jun:"5656",Jul:"7867",Aug:"8990",Sep:"5676",Oct:"4655",Nov:"6778",Dec:"8909", 
Jan1:"3344",Feb1:"5676",Mar1:"7898",Apr1:"9089",May1:"9009",Jun1:"5675",Jul1:"3433",Aug1:"4455",Sep1:"6676",Oct1:"7867",Nov1:"4556",Dec1:"8656"}, 
{Jan:"5678",Feb:"7890",Mar:"3454",Apr:"4565",May:"6756",Jun:"5656",Jul:"7867",Aug:"8990",Sep:"5676",Oct:"4655",Nov:"6778",Dec:"8909", 
Jan1:"3344",Feb1:"5676",Mar1:"7898",Apr1:"9089",May1:"9009",Jun1:"5675",Jul1:"3433",Aug1:"4455",Sep1:"6676",Oct1:"7867",Nov1:"4556",Dec1:"8656"}, 
{Jan:"5678",Feb:"7890",Mar:"3454",Apr:"4565",May:"6756",Jun:"5656",Jul:"7867",Aug:"8990",Sep:"5676",Oct:"4655",Nov:"6778",Dec:"8909", 
Jan1:"3344",Feb1:"5676",Mar1:"7898",Apr1:"9089",May1:"9009",Jun1:"5675",Jul1:"3433",Aug1:"4455",Sep1:"6676",Oct1:"7867",Nov1:"4556",Dec1:"8656"}, 
{Jan:"5678",Feb:"7890",Mar:"3454",Apr:"4565",May:"6756",Jun:"5656",Jul:"7867",Aug:"8990",Sep:"5676",Oct:"4655",Nov:"6778",Dec:"8909", 
Jan1:"3344",Feb1:"5676",Mar1:"7898",Apr1:"9089",May1:"9009",Jun1:"5675",Jul1:"3433",Aug1:"4455",Sep1:"6676",Oct1:"7867",Nov1:"4556",Dec1:"8656"}, 
{Jan:"5678",Feb:"7890",Mar:"3454",Apr:"4565",May:"6756",Jun:"5656",Jul:"7867",Aug:"8990",Sep:"5676",Oct:"4655",Nov:"6778",Dec:"8909", 
Jan1:"3344",Feb1:"5676",Mar1:"7898",Apr1:"9089",May1:"9009",Jun1:"5675",Jul1:"3433",Aug1:"4455",Sep1:"6676",Oct1:"7867",Nov1:"4556",Dec1:"8656"} 
]); 

/** 
* 初始化函數(shù) 
*/ 
protected function initHandler(event:FlexEvent):void 
{ 

} 

/** 
* 刷新按鈕函數(shù) 
*/ 
protected function refresh_clickHandler(event:MouseEvent):void 
{ 
var hx:Object = hsb.left; 
var hy:Number = hsb.y; 

//var dx:Number = dataGrid.contentMouseX; 
//var dy:Number = dataGrid.contentMouseY; 
//Alert.show("hx:"+hx+"\n"+"hy: "+hy + "\n" + "dx: " + dx + "\n" + "dy: " + dy); 
Alert.show("hx:"+hx+"\n"+"hy: "+hy); 
} 

]]> 
/fx:Script> 
fx:Declarations> 
!-- 將非可視元素(例如服務(wù)、值對(duì)象)放在此處 --> 
/fx:Declarations> 

mx:VBox width="100%" height="100%" paddingBottom="10" paddingLeft="10" paddingRight="20" 
paddingTop="10" horizontalAlign="center"> 
mx:HBox width="100%" height="30"> 
s:Label width="100%"/> 
s:Button id="refresh" label="刷新" click="refresh_clickHandler(event)"/> 
/mx:HBox> 
mx:DataGrid width="1350" height="90%" id="dataGrid" dataProvider="{gridArray}" horizontalScrollPolicy="on" textAlign="center"> 
mx:columns> 
mx:DataGridColumn headerText="2013年01月" dataField="Jan" width="200"/> 
mx:DataGridColumn headerText="2013年02月" dataField="Feb" width="200"/> 
mx:DataGridColumn headerText="2013年03月" dataField="Mar" width="200"/> 
mx:DataGridColumn headerText="2013年04月" dataField="Apr" width="200"/> 
mx:DataGridColumn headerText="2013年05月" dataField="May" width="200"/> 
mx:DataGridColumn headerText="2013年06月" dataField="Jun" width="200"/> 
mx:DataGridColumn headerText="2013年07月" dataField="Jul" width="200"/> 
mx:DataGridColumn headerText="2013年08月" dataField="Aug" width="200"/> 
mx:DataGridColumn headerText="2013年09月" dataField="Sep" width="200"/> 
mx:DataGridColumn headerText="2013年10月" dataField="Oct" width="200"/> 
mx:DataGridColumn headerText="2013年11月" dataField="Nov" width="200"/> 
mx:DataGridColumn headerText="2013年12月" dataField="Dec" width="200"/> 
mx:DataGridColumn headerText="2014年01月" dataField="Jan1" width="200"/> 
mx:DataGridColumn headerText="2014年02月" dataField="Feb1" width="200"/> 
mx:DataGridColumn headerText="2014年03月" dataField="Mar1" width="200"/> 
mx:DataGridColumn headerText="2014年04月" dataField="Apr1" width="200"/> 
mx:DataGridColumn headerText="2014年05月" dataField="May1" width="200"/> 
mx:DataGridColumn headerText="2014年06月" dataField="Jun1" width="200"/> 
mx:DataGridColumn headerText="2014年07月" dataField="Jul1" width="200"/> 
mx:DataGridColumn headerText="2014年08月" dataField="Aug1" width="200"/> 
mx:DataGridColumn headerText="2014年09月" dataField="Sep1" width="200"/> 
mx:DataGridColumn headerText="2014年10月" dataField="Oct1" width="200"/> 
mx:DataGridColumn headerText="2014年11月" dataField="Nov1" width="200"/> 
mx:DataGridColumn headerText="2014年12月" dataField="Dec1" width="200"/> 
/mx:columns> 
/mx:DataGrid> 
!-- 
s:HScrollBar id="hsb" width="100%" viewport="{dataGrid}"/> 
--> 

s:HScrollBar id="hsb" width="100%"/> 

/mx:VBox> 
/s:Application>

3、實(shí)現(xiàn)結(jié)果

標(biāo)簽:泰州 欽州 仙桃 滄州 呂梁 海西 攀枝花 佛山

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Flex中怎么給表格中的滾動(dòng)條定位避免刷新回到原處》,本文關(guān)鍵詞  Flex,中,怎么,給,表格,中的,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《Flex中怎么給表格中的滾動(dòng)條定位避免刷新回到原處》相關(guān)的同類信息!
  • 本頁收集關(guān)于Flex中怎么給表格中的滾動(dòng)條定位避免刷新回到原處的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章