常遇到的警告报错(warning: unable to bind to property)的解决办法

http://hi.baidu.com/luming19840827/blog/item/7e715bb7cfbbcbc236d3cace.html

 

rrayCollection 是增强性的 Array,依然是用数组来存储数据,但支持多种排序、属性绑定等,适合用来处理复杂数据。
但是,其子元素是无法作为数据源绑定的。

网上和论坛好友们贴出来的解决办法都是采用ObjectProxy这个类做一个中间代理:
myArrayCollection.push(new ObjectProxy({”label”:”Flex”,”icon”:”assets/fl.png”}))

arrayContactList.addItem(new ObjectProxy({employeeName:pojo.employeeName})
这样其实就是从数据源头来堵住这个可能发生的错误,但是这个做法 有个缺点,他不能应用于标签数据<mx:ArrayCollection />这个格式的数据

今天我尝试了另外一个方法,呵呵,也成功解决这个问题了。

我的解决思路就是通过AS,使用BindingUtils这个类的bindProperty方法,对itemRenderer “主动设置” 绑定数据

修改了原来自定义的itemRenderer为:

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:VBox xmlns:mx=”http://www.adobe.com/2006/mxml” creationComplete=”init();”>
<mx:Script>
<![CDATA[
import mx.binding.utils.BindingUtils;
private function init():void{
BindingUtils.bindProperty(pic,"source",data,"icon");
BindingUtils.bindProperty(bt,"label",data,"label");
}
]]>
</mx:Script>
<mx:Image id=”pic”/>
<mx:Button id=”bt”/>
</mx:VBox>
 

测试发布,哈哈,再也不出现警告错误信息了。

——————————————————————————

(修改于3月6日)
我现在很想说我是个白痴,我是个井底之蛙,我还以为我发现了一个重大的解决办法,其实我错了,我一开始就走弯路了。
按照我那个做法,绑定进行一次,以后再拖动tileList,出来的数据是不会更新的。
我太小家之气了。上面的也不删除了,让自己记住这个错误。
修改上面的自定义itemRenderer为下面这样,就什么都不用考虑了并且一切Ok了。
感谢L4cd

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:VBox xmlns:mx=”http://www.adobe.com/2006/mxml”>
<mx:Script>
<![CDATA[
import mx.binding.utils.BindingUtils;
[Bindable]
private var _data:Object;
[Bindable]
private var _label:String;
[Bindable]
private var _icon:String;
override public function set data(value:Object):void{
_label=value.label;
_icon=value.icon;
_data=value;
}
override public function get data():Object{
return _data;
}
]]>
</mx:Script>
<mx:Image source=”{_icon}”/>
<mx:Button label=”{_label}”/>
</mx:VBox>
 

 

[root@cdh liyaoming]# python3 /zhiyun/liyaoming/python/pws/dws_xbd_mxm_memberinfo_dim_t.py Warning: Ignoring non-Spark config property: hive.metastore.uris Setting default log level to "WARN". To adjust logging level use sc.setLogLevel(newLevel). For SparkR, use setLogLevel(newLevel). 25/11/03 20:32:35 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable 25/11/03 20:32:35 WARN SparkConf: Note that spark.local.dir will be overridden by the value set by the cluster manager (via SPARK_LOCAL_DIRS in mesos/standalone/kubernetes and LOCAL_DIRS in YARN). 25/11/03 20:32:36 WARN Utils: Service 'SparkUI' could not bind on port 4040. Attempting port 4041. 25/11/03 20:32:36 WARN Utils: Service 'SparkUI' could not bind on port 4041. Attempting port 4042. 25/11/03 20:32:36 WARN Utils: Service 'SparkUI' could not bind on port 4042. Attempting port 4043. 25/11/03 20:32:36 WARN Utils: Service 'SparkUI' could not bind on port 4043. Attempting port 4044. 25/11/03 20:32:36 WARN Utils: Service 'SparkUI' could not bind on port 4044. Attempting port 4045. 25/11/03 20:32:36 WARN Utils: Service 'SparkUI' could not bind on port 4045. Attempting port 4046. Traceback (most recent call last): File "/zhiyun/liyaoming/python/pws/dws_xbd_mxm_memberinfo_dim_t.py", line 112, in <module> do_member_check() File "/zhiyun/liyaoming/python/pws/dws_xbd_mxm_memberinfo_dim_t.py", line 54, in do_member_check df = spark.sql(sql) File "/usr/include/openssl/lib/python3.9/site-packages/pyspark/sql/session.py", line 1631, in sql return DataFrame(self._jsparkSession.sql(sqlQuery, litArgs), self) File "/usr/include/openssl/lib/python3.9/site-packages/py4j/java_gateway.py", line 1322, in __call__ return_value = get_return_value( File "/usr/include/openssl/lib/python3.9/site-packages/pyspark/errors/exceptions/captured.py", line 185, in deco raise converted from None pyspark.errors.exceptions.captured.ParseException: [PARSE_SYNTAX_ERROR] Syntax error at or near '.'.(line 7, pos 22) == SQL == select member_id, b.orgname as rec_detect_store, --最近检测门店 from ods_liyaoming.his_chronic_patient_info_new_full c ----------------------^^^ left join dwd_liyaoming.crm_user_base_info_his_full b c.member_id = b.memcardno group by c.member [root@cdh liyaoming]#
最新发布
11-04
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值