-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I should use checkbox to check and uncheck all rows in grid.
I tried use this example:
http://zkfiddle.org/sample/1vilk89/1-Grid-for-checking-all-checkboxes#source-1
It doesn't work for me with because of type cast errors.
Method "grid.getRows().getChildren()
" got more rows, than exist in table. But this example works on the site.
I tried another method when I go for each rows and each columns, select components, which have class - "Checkbox", and change theigh "checked" attribute. It works for me.
But in the both cases I got the same bug.
Could you help me to understand the reason?
Have you considered using Listbox, which features the checkboxes/checkall out of the box. as in this example on zk fiddle.
also check http://books.zkoss.org/wiki/ZKComponentReference/Data/Listbox#TheCheckmarkProperty
You can then access the selection either by the ListModel attached to the listbox, or Listbox.getSelectedItems()
Regards,
Robert
I use this code for listbox in ZK 7.0.0 and the listbox doesn't have a "checkall" button and also it doesn't have multiselect like in this example http://www.zkoss.org/zkdemo/listbox/multiple_selection
<listbox id="dgProcesses"
multiple="true" checkmark="true"
style="overflow:hidden;"
paginal="${paginator}"
mold="paging" pageSize="20" >
<listhead>
<listheader label="№" width="50px" align="center" />
<listheader
label="Тип документа" sort="auto" width="100%" />
<listheader label="НПФ"
sort="auto" align="center" width="150px" />
<listheader
label="Статус" sort="auto" width="100px" align="center" />
<listheader
label="Время изменения" sort="auto" align="center"
width="130px" />
</listhead>
<template name="model">
<listitem height="50px">
<listcell
label="${forEachStatus.index + 1}" />
<listcell
label="${each.type}" />
<listcell
label="${each.npf}" />
<listcell
label="${each.status}" />
<listcell
label="${each.updateTime}" />
</listitem>
</template>
</listbox>
if you read the documentation link i provided above (http://books.zkoss.org/wiki/ZKComponentReference/Data/Listbox#TheCheckmarkProperty) you'll see that the check all is only available if ROD is disabled, as in my fiddle example (http://zkfiddle.org/sample/21nf924/1-listbox-select-all)
cor3000 ( 2014-03-07 07:34:06 +0800 )editAsked: 2014-03-06 11:26:29 +0800
Seen: 62 times
Last updated: Mar 07 '14
With the grid case I found that If I wait sometimes then click on the "checkall" checkbox again it works as expected! But only two times with the same scenario which described in question.
venicum ( 2014-03-07 12:11:36 +0800 )edit