Flex中怎么给表格中的滚动条定位避免刷新回到原处_Flex

来源:脚本之家  责任编辑:小易  

一、在Excel中做的表格怎样做到拉动滚动条时让标题不动,像固定在那的一样。处理方法如下:1、启动excel应用程序,选中标题行或全选工作表;2、选择视图功能区→冻结窗口→冻结首行,就实现了标题行不滚动,而工作表内容滚动。二、Excel中除了可以采用冻结首行的方式保证标题首行不滚动,还可以通过定位到某一个单元格,再选择视图功能区的冻结拆分窗格,以实现当前单元格定位的上一行、前一列内容不滚动,方便查看www.zgxue.com防采集请勿采集本网。

1、问题背景

会有这个问题,所以如果你的列是固定的,最好每个列都设置一个列宽。

如果表格中的字段过多,会出现滚动条,在将滚动条滚到一定的位置时,重新刷新表格,滚动条会回到原处,原来查看的字段还得继续滚动,才能查看到。

会不会你选择了显示窗口的最右下角单元格,并设置了“冻结窗口”?在这种情况下滚动条即使没有锁定,滚动时窗口不会跟着发生变化。当Excel文档中有大量的数组计算和查找引用时,会占用系统处理器资源,

2、实现实例

1、电脑双击Excel图标,打开表格 2、双击Excel表格左上方的【文件】 3、点击文件菜单下的【选项】 4、在选项的左侧栏,点击【视图】 5、在视图里面的窗口选项下面,有水平滚动条和垂直滚动条两个

<?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] //表格数据绑定 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"} ]); /** * 初始化函数 */ protected function initHandler(event:FlexEvent):void { } /** * 刷新按钮函数 */ 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> <!-- 将非可视元素(例如服务、值对象)放在此处 --> </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>

table设置overflow-x:auto,overflow-y:hidden thead设置overflow:hidden tbody设置overflow-y:hidden,overflow-x:hidden 还有就是你table要定宽高

3、实现结果

dataGrid.verticalScrollPosition=90(或100)就可以了,verticalScrollPosition这个属性是用于设置当前表格的纵向滚动位置(即当前第一行显示的是第几条数据)

有两个方法1、按ctrl+g。定位,输入单元格的名称。2、直接在表格A1上面那个栏里输入单元格的名称内容来自www.zgxue.com请勿采集。


  • 本文相关:
  • 获取到advanceddatagrid选中行的全部数据
  • flex播放器(实现播放、缓冲进度条和音频曲线显示)
  • flex小技巧之加载gif图片
  • flex4 panel去掉标题设置透明度效果代码
  • ie9下关闭弹出窗口出现__flash__removecallback未定义错误
  • 全面了解flex的用途
  • flex动态加载swf皮肤示例代码
  • flex项目中server的名称修改方法探讨
  • flex复选框和下拉列表的几种用法整理
  • flex arraycollection删除过滤的数据问题解决
  • Flex中怎么给表格中的滚动条定位避免刷新回
  • 在EXCEL中做的表格怎样做到拉动滚动条时让标题不动。(像固定在那的一样)
  • excel里滚动条能滚动,但是表格里面的内容不动,是怎么回事啊,求助各位大神,麻烦指点一下,谢谢
  • 如何在一张表格中添加滚动条
  • 关于flex中DataGrid滚动条问题
  • 请问excel表格中的滚动条怎么解锁
  • excel表格下方滚动条怎么设置
  • HTML中给表格添加滚动条问题
  • 关于Flex中DataGrid滚动条问题
  • EXCEL表格中下方的滚动条怎么不见了,应如何设置?
  • 网站首页网页制作脚本下载服务器操作系统网站运营平面设计媒体动画电脑基础硬件教程网络安全javascriptasp.netphp编程ajax相关正则表达式asp编程jsp编程编程10000问css/htmlflex脚本加解密web2.0xml/rss网页编辑器相关技巧安全相关网页播放器其它综合dart首页flex获取到advanceddatagrid选中行的全部数据flex播放器(实现播放、缓冲进度条和音频曲线显示)flex小技巧之加载gif图片flex4 panel去掉标题设置透明度效果代码ie9下关闭弹出窗口出现__flash__removecallback未定义错误全面了解flex的用途flex动态加载swf皮肤示例代码flex项目中server的名称修改方法探讨flex复选框和下拉列表的几种用法整理flex arraycollection删除过滤的数据问题解决flex复选框和下拉列表的几种用法flex与js通信与彼此之间的互调整flex中advanceddatagrid的用法示flex label自动截取、自动换行代flex中如何动态生成datagrid以及flex播放器(实现播放、缓冲进度条flex chrome浏览器调试出现空白的flex导出excel具体实现flex 输出文件到本地的两种方法flex4 panel去掉标题设置透明度效如何在renderer中设置属性 renderer中设置flex帮助文档(html格式)制作及asdoc的使用flex label自动截取、自动换行代码flex4 datagrid中如何嵌入radiobuttonflex读取txt文件中的内容报错原因分析及解手把手教你使用flex eclipse整合springflex与js通信与彼此之间的互调整理(一)flex中textinput组件设置限制某些字符的输flex导出excel具体实现flex4.0 利用外部项呈示器显示list信息并
    免责声明 - 关于我们 - 联系我们 - 广告联系 - 友情链接 - 帮助中心 - 频道导航
    Copyright © 2017 www.zgxue.com All Rights Reserved