选择所有复选框Lotus xpages [英] Select All checkbox lotus xpages

查看:51
本文介绍了选择所有复选框Lotus xpages的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个具有视图控件的Xpages应用程序.我尝试在列标题中放置一个复选框以选中视图中的所有复选框.问题是当我从视图转到另一个页面时,未检查其行,并且仅在可见页面上进行了选择.因此,我希望能够选择视图所有页面中的所有行,当从视图的一页切换到另一页面时,没有选择的情况就会消失.

I'm working on an Xpages application on which I have a view control. I tried to put a checkbox in the column header to select all of the check boxes in the view. The problem is when I go to another page from the view, its lines are not checked and the selection is made only on the visible page. So, I want to be able to select all the rows in all the pages of the view, this without the selection disappears when switching from one page to another of the view.

推荐答案

视图和选择存在几个问题.

There are couple of problems with views and selections.

首先,在页面之间移动的分页器操作不会处理选择所有行"数据,因为默认情况下启用了部分执行.如果将 partialExecute ="false" 放入分页器,您将看到在页面之间将保留选择所有行"复选框.

First of all, pager actions to move between pages does not process 'select all rows' data because it is enabled to use partial execution by default. If you put partialExecute="false" into your pager, you will see that 'select all rows' checkbox will be maintained between pages.

但是,如果您在列和columnHeader上都具有一个复选框,则该组件将在后端维护一个selectedIds数组.不幸的是,该数组仅包含可见的选择.因为该数组由viewPanel组件维护,所以它不知道未显示的数据条目列表.

However, if you have a checkbox on a column and the columnHeader, the component maintains a selectedIds array in the back-end. Unfortunately, this array holds only visible selections. Because the array is maintained by the viewPanel component, which is not aware of the list of data entries that are not shown.

此外,复选框实现没有提供任何机制,您可以在后端抓取选择以在页面之间缓存它们.

Also, checkbox implementation does not provide any even mechanism where you can grab selections on the back-end to cache them between pages.

要确定选中所有复选框,可以使用一些技巧.假设您正在使用所有默认样式;

To determine select all checkbox can be doable with a little trick. Assuming you are using all default styles;

<xp:inputHidden
    id="inputAllSelected"
    value="#{viewScope.allSelected}"
    defaultValue="false"></xp:inputHidden>
<xp:scriptBlock
    id="scriptBlock1">
    <xp:this.value><![CDATA[
function getSelectAllCheckbox() {
    return dojo.query("input.xspCheckBoxViewColumnHeader")[0];
}

function toggleSelectAll(){
    dojo.byId("#{id:inputAllSelected}").value=getSelectAllCheckbox().checked;
}

dojo.addOnLoad(function() { 
    dojo.connect(getSelectAllCheckbox(), "onchange", toggleSelectAll);
});
]]></xp:this.value>
</xp:scriptBlock>

要在页面之间缓存复选框,您将使用自定义列来实现自己的复选框.我建议使用数据表组件来获得更大的灵活性.

To cache checkboxes between pages, you would implement your own checkboxes by using custom columns. I recommend using a data table component to get more flexibility.

这篇关于选择所有复选框Lotus xpages的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆