Flex DataGrid可编辑对象实现Enter跳转
来源:http://blog.sina.com.cn/s/blog_5ed17a730100vrja.html
在Flex DataGrid中实现点击Enter键可编辑对象跳转
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" width="100%"
height="100%" creationComplete="init()">
<mx:DataGrid id="dg" dataProvider="{ac}" height="232" editable="true">
<mx:columns>
<mx:DataGridColumn headerText="姓名" dataField="name"/>
<mx:DataGridColumn headerText="年龄" dataField="age"/>
</mx:columns>
</mx:DataGrid>
<mx:ArrayCollection id="ac">
<mx:Object name="111" age="11"/>
<mx:Object name="222" age="22"/>
<mx:Object name="333" age="33"/>
<mx:Object name="444" age="44"/>
<mx:Object name="555" age="55"/>
<mx:Object name="666" age="66"/>
</mx:ArrayCollection>
<mx:Script>
<![CDATA[
import mx.core.EdgeMetrics;
import mx.events.DataGridEvent;
import mx.events.ListEvent;
private function init():void {
addEventListener(KeyboardEvent.KEY_DOWN, enterKHandler);
}
private function enterKHandler(evt:KeyboardEvent):void {
if(dg.editedItemPosition == null) {
return;
}
var editpos:Object = dg.editedItemPosition;
if(evt.keyCode == Keyboard.ENTER){
if(editpos.rowIndex == dg.dataProvider.length-1) {
if(editpos.columnIndex < dg.columnCount-1) {
editpos.columnIndex ++;
dg.editedItemPosition = editpos;
} else if(editpos.columnIndex == dg.columnCount-1) {
var obj:Object = {name:"777", age:"7"};
ac.addItem(obj);
editpos.rowIndex ++;
editpos.columnIndex = 0;
dg.editedItemPosition = editpos;
}
} else if(editpos.rowIndex < dg.dataProvider.length-1) {
if(editpos.columnIndex < dg.columnCount-1) {
editpos.columnIndex ++;
dg.editedItemPosition = editpos;
} else {
editpos.rowIndex ++;
editpos.columnIndex = 0;
dg.editedItemPosition = editpos;
}
}
}
}
]]>
</mx:Script>
</mx:Application>
Flex DataGrid可编辑对象实现Enter跳转的更多相关文章
- Flex DataGrid 添加控件
哈喽,又和大家见面了.今天要写的东西是关于Flex DataGrid添加“编辑”或“删除”按钮. 下面是部分代码: <mx:DataGrid id="dgShow" x=&q ...
- EasyUI DataGrid能编辑
创建DataGrid <table id="tt"></table> $('#tt').datagrid({ title:'Editable Dat ...
- datagrid直接编辑保存“设计缺陷”
当今使用easyUI的datagrid组件的时候,碰到了一些问题,记录下来以便下次高速解决. 需求是在一张表单里会关联有一个列表,能够增删查改 曾经没用easyUI的时候,这个增和改的页面我通常是用一 ...
- JAVA-JSP内置对象之response对象实现页面跳转
相关资料:<21天学通Java Web开发> response对象 实现页面跳转1.可以通过response对象的sendRedirect()方法设置页面重定向,从而实现页面跳转.2.这种 ...
- EasyUI效果--DataGrid的编辑效果
DataGrid的编辑效果是我目前使用的easyUI的第三个效果,相对于前两个,这个算是比较复杂点了. 运行起来的效果,大概就是这样,任意点击某行,然后该行变为可以编辑的,失去焦点之后,该行恢复 ...
- easyui datagrid 批量编辑和提交数据
easyui datagrid 行编辑和提交方,废话就不多说了,直接上代码 <div style="margin: 5px;"> <table id=" ...
- easyui分页,编辑datagrid某条数据保存以后跳转到某一页
参考资料:http://caizhilin2010.iteye.com/blog/1731698 问题:商品列表页面采用easyui的datagrid展示数据,编辑某行数据保存以后,要求跳转到 用户在 ...
- SharedObject使用:在FluorineFx.net与Flex中使用共享对象维护在线用户列表实例【转】
一.添加一个新的FluorineFx的服务类项目OnLineService,删除原有的Sample.cs,并添加一个用户类定义与一个ApplicationAdpater类:如下: /*-- User. ...
- [转]easyui datagrid 批量编辑和提交
web前台主要代码: <script type="text/javascript"> $(function() { var $dg = $("#dg" ...
随机推荐
- epoll & socket 连接数突破
http://shenfeng.me/how-far-epoll-can-push-concurrent-socket-connection.html
- 移居 GitHub
博客很久没能更新了,很多代码也从博客园逐渐转移到 GitHub,欢迎新老用户光顾: https://github.com/kedebug 个人博客:http://kedebug.me/
- theano学习
import numpy import theano.tensor as T from theano import function x = T.dscalar('x') y = T.dscalar( ...
- axis2 调用webservice
maven配置:主要引用包及plugins <properties> <axis2.version>1.6.1</axis2.version> </prope ...
- 安卓手机 虚拟键盘输入用 position:fixed解决 !!!
下面 主要代码 方便看. 样式 <style> *{ margin:0; padding:0; } html{ height:100%;/*关键代码*/ } body{ height:10 ...
- PowerDisner15 关于生成表带双""号问题
我们可以尝试在DBMS配置文件中修改相应的格式来解决. 在PowerDesigner中 选择 Database->Edit current database->Script->Sql ...
- ios项目里扒出来的json文件
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Menlo; color: #000000 } p.p2 { margin: 0.0px 0. ...
- ios获取设备信息总结
1.获取设备的信息 UIDevice *device = [[UIDevice alloc] int]; NSString *name = device.name; //获取设备所有者的名 ...
- F#之旅5 - 小实践之下载网页(爬虫基础库)
参考文章:https://swlaschin.gitbooks.io/fsharpforfunandprofit/content/posts/fvsc-download.html 参考的文章教了我们如 ...
- ExtJS 中类的继承
ExtJS 允许对现有的类进行扩展,其扩展可以通过继承来实现.接下来我们就对刚刚使用ExtJS定义的Person类进行继承,定义一个Developer类,它继承自Person,同时还拥有Coding方 ...