ZK showing huge data with List box on internet explorer, cause javaScript error
I am trying to show about 300 header and 1000 row with zk listbox, but on Internet explorer it gives "Stop running this script?" error. If I click no it continues and opens my list box. On firefox and ınternet Explorer 9 it works normal but I should use explorer 8 . Here my not working solution
<listbox id="listModel" rows="15"
mold="paging" pageSize="15">
<listhead >
<listheader id="${each}"
style="overflow:auto" label="${each}" width=" 250px"
forward="onDoubleClick=onRemoveFromHeader"
for开发者_StackOverflow中文版Each="${comboModelColumns}" />
<custom-attributes
headers="${each}" />
</listhead>
<listitem
forEach="${listValues}">
<listcell
forEach="${listValues[forEachStatus.index]}"
label="${each}" />
</listitem>
</listbox>
here combomodelColumns
list of 300 string. and listValues
is a list taht contains 1000 list. And each list contains about 300 string too.
Internet Explorer unfortunately does not execute speeds at the same rate as Firefox and other browsers. If a thread takes longer than a few seconds to execute, IE offers this dialog to the user.
I would recommend that you paginate your listbox:
<listbox mold="paging" pageSize="5"/>
Additionally, ZK allows you to use paging events allow you to decide when to populate more data into your listbox, etc.
Take a look at:
http://books.zkoss.org/wiki/ZK_Component_Reference/Supplementary/Paging
I solved problem.
this is my zk component
<listbox id="listModel" rows="15"
mold="paging" pageSize="15">
<listhead >
<listheader
style="overflow:auto" label="${each}" width=" 250px"
forward="onDoubleClick=onRemoveFromHeader"
forEach="${tmpHeaders}" />
<custom-attributes
headers="${each}" />
</listhead>
<listitem
forEach="${tmpListValue}">
<listcell
forEach="${tmpListValue[forEachStatus.index]}"
label="${each}" />
</listitem>
</listbox>
I created firtly only 18 header , but I took hole data in onotherlist. when I choose some header from my combobox , manually added to listbox headers and row data.
Listheader newheader = new Listheader();
newheader.setLabel(listBox_Columns.getSelectedItem().getLabel());
newheader.setWidth("250px");
org.zkoss.zk.ui.sys.ComponentsCtrl.applyForward(newheader, "onRemoveFromHeader");
listModel.getListhead().appendChild(newheader);
for (int i = 0; i < listValues.size(); i++) {
List tmpCurrentRow = (List) listValues.get(i);
List tmpRows = new ArrayList();
Listcell newCell = new Listcell(tmpCurrentRow.get(findIndexHeaderByName(listBox_Columns.getSelectedItem().getLabel(), allHeaders)).toString());
((Listitem) listModel.getItems().get(i)).appendChild(newCell);
}
thats all.Also I added remove header function to remove added header and cells. It simply sets visibility false.
public void onRemoveFromHeader(ForwardEvent event) {
Listheader listheader = (Listheader) event.getOrigin().getTarget();
listheader.setVisible(false);
listBox_Columns.setSelectedItem(null);
}
精彩评论