zk listbox checkmark="true" 时脚本控制选中行时的bug:
一,证明bug事例
listbox代码如下
<script type="text/javascript" src="/js/linkFax.js"> </script> <button label="不选" w:onClick="linkFax.faxbox.selectZero();"/>
<listbox vflex="true" id="faxList" multiple="true" checkmark="true" oddRowSclass="non-odd"> <listhead> <listheader width="25px"></listheader> <listheader width="30px"></listheader> <listheader label="收件人" width="200px"></listheader> <listheader width="25px"></listheader> <listheader label="主题"></listheader> <listheader label="时间" width="80px"></listheader> </listhead> <listitem height="30px"> <listcell> <label visible="false" value="faxId:1:0:7:1:2:0"></label> </listcell> <listcell> <div> <image src="/images/email_unread.png" style="float:left;" /> <image src="/images/level1_mini.png" style="float:right;" /> </div> </listcell> <listcell> 我 </listcell> <listcell image="/images/marktrans.png" tooltiptext="标记为红色"></listcell> <listcell> 234324324324 </listcell> <listcell></listcell> </listitem> </listitem>
js脚本如下:
1, faxList函数功能:获得当前listbox Widget
2,eachFaxList函数功能:遍历faxList,并回调设置的函数
3,selectZero函数功能:取消所有选中的行
faxList : function() { if (this._faxList) { return this._faxList; } this._faxList = zk.Widget.$(jq("$faxList")); return this._faxList; }, eachFaxList : function(callback) { var itemInter = this.faxList().itemIterator(); while (itemInter.hasNext()) { var faxRecord = _linkFax.faxRecord.init(itemInter.next()); callback.apply(this, [ faxRecord ]); } }, selectZero : function() { this.eachFaxList(function(faxRecord) { if (faxRecord.isSelected()) { faxRecord.selectRecord(false); } }); }, // 暴露linkFax window.linkFax = _linkFax;
二,证明bug步骤
不选按钮的功能为取消所有选中行,当点击按钮时,所有选中行取消了选中状态,此时把鼠标移动到listbox 标题中的checkbox上,当鼠标移到checkbox时,此checkbox自动设置为选中状态 ,因为所有行已经取消了选中状态,此时标题栏中的checkbox不应该选中。
在此情况下,该标题栏的checkbox告诉用户,listbox为全选状态,但实际不是!这样就误导了用户,另外,因为其为选中状态,所以用户如果像选中所有行,那么用户必须取消标题栏checkbox的选中,然后第二次点击,才可以选中所有行,
这样让用户多了一步操作!!
三,解决办法
还未发现如何解决,待解中。。。。。。。。。。。。。。。