b30-1849239.zul

来自「ZK是一个Ajax Java Web框架」· ZUL 代码 · 共 37 行

ZUL
37
字号
<?xml version="1.0" encoding="UTF-8"?>

<window>
<html><![CDATA[
1. Press button "Insert at index 0", this program will insert a new Listitem at index 0.<br/>
2. The new inserted item should be always the first child of the Listbox but it is not.<br/>
3. You can check the sequence of Listitem.getItems() by pressing the button "Listitem.getItems()" and it is correct.<br/>
4. The issue should be in the ZK client engine.<br/>
5. Take away the &lt;listhead> will make it works correct so it has something to do with the &lt;listhead>.<br/>
]]></html>
<listbox id="lbx">
	<listhead>
		<listheader label="header"/>
	</listhead>
	<listitem label="Mark"/>
</listbox>
<zscript>
 int x = 0;
</zscript>
<button label="Insert at index 0">
	<attribute name="onClick">
	Listitem li = new Listitem("NewItem"+ ++x);
	lbx.insertBefore(li, lbx.getItemAtIndex(0));
	</attribute>
</button>
<button label="Listitem.getItems()">
	<attribute name="onClick"><![CDATA[
		StringBuffer sb = new StringBuffer(124);
		for(Iterator it = lbx.getItems().iterator(); it.hasNext();) {
			Listitem li = (Listitem) it.next();
			sb.append(li.getLabel()+",");
		}
		alert(sb.toString());
	]]></attribute>
</button>

</window>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?