<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initApp()" layout="vertical" fontSize="12" backgroundColor="white"> <mx:Script>
<![CDATA[ import mx.collections.ArrayCollection; [Bindable]
private var AC1:ArrayCollection; private function initApp():void{
AC1=new ArrayCollection([{name:"开会",type:"紧急",steps:"0"},
{name:"结算",type:"一般",steps:"0"},
{name:"放假",type:"一般",steps:"0"}]); } protected function fun_AddImage(event:MouseEvent):void
{
trace(AC1); for(var i:int=0; i<AC1.length; i++) {
trace(AC1[i].steps); }
} ]]>
</mx:Script> <mx:DataGrid rowCount="4" dataProvider="{AC1}" id="dg" >
<mx:columns>
<mx:DataGridColumn headerText="name" dataField="name"/>
<mx:DataGridColumn headerText="type" dataField="type"/>
<mx:DataGridColumn headerText="email">
<mx:itemRenderer>
<mx:Component>
<mx:TextInput text="{data.steps}"/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid> <mx:Button x="326" y="513" label="测试数据" click="fun_AddImage(event)"/> </mx:Application> 调试提示:
warning: unable to bind to property 'steps' on class 'Object' (class is not an IEventDispatcher) 现在需要的效果是在DG的输入框里修改了文字后,数组ac1的steps字段也会更着修改
点测试后出现的数字是在DG中输入的数字,现在的问题应该是自定义的列无法和数据源ac1中的steps绑定的问题。
/*如果数据只是文本的,下面的代码就可以完成你要的功能
* 注意 editable="true"
*如果是复杂的数据类型,需要在列中定义 itemEditor="{new ClassFactory(XXXX)}"
*<< 狗狗熊 奉上 >>
*/ <?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initApp()" layout="vertical" fontSize="12" backgroundColor="white">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
private var AC1:ArrayCollection;
private function initApp():void{
AC1=new ArrayCollection([{name:"开会",type:"紧急",steps:"0"},
{name:"结算",type:"一般",steps:"0"},
{name:"放假",type:"一般",steps:"0"}]);
} protected function fun_AddImage(event:MouseEvent):void
{
trace(AC1); for(var i:int=0; i<AC1.length; i++) {
trace(AC1[i].steps); }
} ]]>
</mx:Script>
<mx:DataGrid rowCount="4" dataProvider="{AC1}" id="dg" editable="true" >
<mx:columns>
<mx:DataGridColumn headerText="name" dataField="name" editable="false"/>
<mx:DataGridColumn headerText="type" dataField="type" editable="false"/>
<mx:DataGridColumn headerText="email" dataField="steps" />
</mx:columns>
</mx:DataGrid>
<mx:Button x="326" y="513" label="测试数据" click="fun_AddImage(event)"/>
</mx:Application>
AC1=new ArrayCollection([{name:"开会",type:"紧急",steps:"0"},
{name:"结算",type:"一般",steps:"0"},
{name:"放假",type:"一般",steps:"0"}]);
}
改成:
var array1:Array = [{name:"开会",type:"紧急",steps:"0"},
{name:"结算",type:"一般",steps:"0"},
{name:"放假",type:"一般",steps:"0"}];
var array2:Array = new Array();
for(var i:int = 0;i<array1.length;i++){
array2.push(new ObjectProxy(array1[i]));
}
AC1 = new ArrayCollection(array2); 原因:ObjectProxy实现了IEventDispatcher接口

flex中DataGrid里使用itemRenderer后数据无法绑定到数据源的问题的更多相关文章

  1. Linq中使用反射实现--LINQ通用数据表绑定DataGrid控件的方法(原创)

    项目需求,因为项目中存在很多表,这些表的内容需要呈现给客户浏览.转载请注明出处 相信很多写过程序的设计者很容易的用以下方式实现 在SqlConnect ,DataSet 的方式,我们很轻松的可以通过S ...

  2. WPF中DataGrid垂直滚动条滚动后导致每行CheckBox选择错乱

    问题: WPF的DataGrid中出现选取或者多选以及单选的时候,出现滚动条的时候,如果发生了滚动,默认情况下就会出现已经选择的CheckBox错乱.这样的原因何在? 解决方案: 经过查阅资料,了解到 ...

  3. Silverlight 中datagrid控件-- 通过设置数据虚拟化加速显示

    定义依赖属性作为datagrid的数据源 protected static readonly DependencyProperty ViewLogsProperty = DependencyPrope ...

  4. 关于EsayUI中datagrid重复提交后台查询数据的问题

    直接上代码: <table id="XXXX" style="width:100%;height:100%;" class="easyui-da ...

  5. django django中的HTML控件及参数传递方法 以及 HTML form 里的数据是怎么被包成http request 的?如何在浏览器里查看到这些数据?

    https://www.jb51.net/article/136738.htm django中的HTML控件及参数传递方法 下面小编就为大家分享一篇django中的HTML控件及参数传递方法,具有很好 ...

  6. HTML中head里的内容经浏览器解析后全到body里了

    HTML中head里的内容经浏览器解析后全到body里了 修改完代码后,用chrome审查元素,head里的内容都到body中去了 http://bbs.csdn.net/topics/3802586 ...

  7. 解决:HTML中多文本域(textarea)回车后数据存入数据库,EL表达式取出异常。

    问题描述: 当多文本域(textarea)回车后数据存入数据库. EL表达式取出异常,值换行倒置页面报错. 问题解决: 存值脚本代码,提交前转换\n为<br/>. <script t ...

  8. VB.NET中使用Linq TO SQL添加数据后获得自增长列ID

    VB.NET中使用Linq TO SQL添加数据后获得自增长列ID: Dim tempOrdre As New Order With { .CustomerID = cmbCustomerName.S ...

  9. Flex中如何通过showAllDataTips属性使鼠标移动到图表时显示所有的数据Tips的例子

    原文 http://blog.minidx.com/2008/11/10/1616.html 接下来的例子演示了Flex中如何通过showAllDataTips属性,使鼠标移动到图表时显示所有的数据T ...

随机推荐

  1. 嵌入式 fork与vfork的区别

    fork()与vfock()都是创建一个进程,那他们有什么区别呢?总结有以下三点区别: 1.  fork  ():子进程拷贝父进程的数据段,代码段     vfork ( ):子进程与父进程共享数据段 ...

  2. 常用的Oracle数据库语句 (待更新完毕)

    一.常用的查询语句 1.1 常用查询 查表中有多少个字段 select count(*) from user_tab_columns where table_name=upper('表名') 或者 s ...

  3. iOS学习笔记之回调(一)

    什么是回调 看了好多关于回调的解释的资料,一开始总觉得这个概念理解起来有点困难,可能是因为自己很少遇到这种类型的调用吧.探索良久之后,才算有点启发,下面是自己的一点理解. 我们知道,在OSI网络七层模 ...

  4. 对于cocos2d-x lua的防护措施

    自从cocos2d-x 用了 luajit之后,对于我们用lua开发的开发者来说,可是一个好消息,不单性能提升了不少,更重要的是在lua加密方面省了不少心,为什么,就是因为,luajit编译的字节码, ...

  5. 禁止Windows安装软件

    今天电脑莫名安装上百度杀毒,想永久解决这个问题. 1.卸载百度杀毒 2.运行cmd-->sc delete 'service name' 3.sc delete BDMiniDlUpdate/B ...

  6. CentOS7 安装 swoole

    sudo pecl install swoole 即可安装.安装完后修改php.ini,加入extension=swoole.so 重启 sudo systemctl restart php-fpm ...

  7. 《C陷阱与缺陷》读书笔记

    1. 词法“陷阱” = 不同于 == , 可以通过if( 1 == a )来避免 & | 不同于 && || 词法分析中的“贪心法” 编译器将程序分解成符号的方法是,从左到右一 ...

  8. 【工作备忘】suricata

    因为工作遇到的困难,我向suricata的某个作者发送了邮件. On Wed, Sep 11, 2013 at 8:22 AM, likeyi <929812468@qq.com> wro ...

  9. 【开源项目之路】jquery的build问题

    在刚开始clone了jquery到本地build的时候,就遇到了问题. “ENORESTARGET No tag found that was able to satisfy ...” 提示为bowe ...

  10. mysql 用户权限

    创建用户 CREATE USER username IDENTIFIED BY 'password';