0

我试图用 zk 列表框显示大约 300 个标题和 1000 行,但在 Internet Explorer 上它给出“停止运行这个脚本?” 错误。如果我单击否,它将继续并打开我的列表框。在 firefox 和 ıinternet Explorer 9 上它可以正常工作,但我应该使用 explorer 8 。这是我不工作的解决方案

<listbox id="listModel" rows="15" 
                                        mold="paging" pageSize="15">
                                        <listhead >
                                            <listheader id="${each}"  
                                                style="overflow:auto" label="${each}" width=" 250px"
                                                forward="onDoubleClick=onRemoveFromHeader"
                                                forEach="${comboModelColumns}"  />
                                            <custom-attributes
                                                headers="${each}" />
                                        </listhead>
                                        <listitem
                                            forEach="${listValues}">
                                            <listcell
                                                forEach="${listValues[forEachStatus.index]}"
                                                label="${each}" />
                                        </listitem>
                                    </listbox> 

这里combomodelColumns列出了 300 个字符串。并且listValues是一个包含 1000 个列表的列表。每个列表也包含大约 300 个字符串。

4

2 回答 2

1

遗憾的是,Internet Explorer 的执行速度不如 Firefox 和其他浏览器。如果线程执行时间超过几秒钟,IE 会向用户提供此对话框。

我建议您对列表框进行分页:

<listbox mold="paging" pageSize="5"/>

此外,ZK 允许您使用分页事件来决定何时将更多数据填充到列表框中等。

看一眼:

http://books.zkoss.org/wiki/ZK_Component_Reference/Supplementary/Paging

于 2011-05-24T14:26:04.347 回答
0

我解决了问题。

这是我的 zk 组件

<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>

我只创建了 18 个标头,但我在 onotherlist 中获取了孔数据。当我从我的组合框中选择一些标题时,手动添加到列表框标题和行数据中。

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);

    }

仅此而已。我还添加了删除标题功能以删除添加的标题和单元格。它只是将可见性设置为假。

public void onRemoveFromHeader(ForwardEvent event) {


        Listheader listheader = (Listheader) event.getOrigin().getTarget();
        listheader.setVisible(false);

        listBox_Columns.setSelectedItem(null);

    }
于 2011-06-08T09:30:05.727 回答