2017-08-23 4 views
0

sort = "auto"のlistheader要素がありますが、その列をクリックするとリストはソートされません。矢印が表示され、方向が逆になりますが、リストの順序は変わりません。オブジェクトのsort = "auto"の使い方は?

リストに追加されたコンポーネントは、org.zkoss.zul.Aオブジェクトです。これはソートが機能しない理由と思われます。

リスト項目がAオブジェクトであるリストボックスでソートが機能する回避策がありますか?

私のZUL:グルーヴィー

<listbox id="myList" checkmark="true" multiple="true"> 
    <listhead> 
    <listheader id='select' label="" width="30px" align="left"/> 
    <listheader label="myLabel" width="75px" sort="auto"/> 
    </listhead> 
</listbox> 

Listitem li = new Listitem(value: "myId") 
li.appendChild(new Listcell()) 
Listcell listcell = new Listcell() 
Long theId = "12345" 
A link = new A(label: theId.toString(), style: "color:blue;") 
listcell.appendChild(invoiceLink) 
li.appendChild(listcell) 
+0

コードが不完全または間違っているようです。 – aristotll

答えて

0

MVVMのアプローチを使用してI'am、これは私が私のリストボックスthis paragraph in the documentationによると

<listbox> 
    <listhead> 
     <listheader label="Hopper" width="60px" sort="auto(hopperCode)" /> 
     <listheader label="Stop Time" width="80px" sort="auto(startTime)" /> 
    </listhead> 
    <template name="model"> 
     <listitem> 
      <listcell label="@load(each.hopperCode)" /> 
      <listcell label="@load(each.startTime)" /> 
     </listitem> 
    </template> 
</listbox> 
0

、ソート自動車を並べ替える方法ですによってリストセルのラベルで並べ替えます。 Listcell.setLabel()は使用していませんが、Aコンポーネントが追加されています。リストセルのラベルはすべて同じ(つまり、 "")なので、並べ替えは何もしません。

お試しsetting custom comparatorsこの目的のために、私は自分自身でlistitemsを作る代わりに、モデルを使うことを勧めます。

関連する問題