Check all rows in grid

asked 2014-03-06 11:26:29 +0800

venicum gravatar image venicum
21 4

updated 2014-03-06 18:35:43 +0800

I should use checkbox to check and uncheck all rows in grid.

I tried use this example:


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.

  • The first time when I click on "checkall" checkbox - all checkboxes in rows were checked as expected.
  • The second time when I click on "checkall" checkbox - all checkboxes in rows were unchecked as expected.
  • But the third time and other times when I click on "checkall" checkbox nothing happen. Only "checkall" checkbox switch between check/uncheck states, but others are not.

Could you help me to understand the reason?

delete flag offensive retag edit


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

3 Answers

Sort by » oldest newest most voted

answered 2014-03-07 14:38:39 +0800

MVarun gravatar image MVarun flag of India
268 1 6

Hi venicum,

To use the checkmark properities in a better way use <listbox> instead of grid.

Hope this demo.. as well as docs.. will help you.


M Varun.

link publish delete flag offensive edit

answered 2014-03-07 02:33:10 +0800

cor3000 gravatar image cor3000
4293 1 7
ZK Team

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



link publish delete flag offensive edit


Hello, cor3000. Can you help with code?

venicum ( 2014-03-07 06:38:21 +0800 )edit

the example link contains code

cor3000 ( 2014-03-07 06:54:28 +0800 )edit

Sorry, it's a draft version of comment. I talk about the code below.

venicum ( 2014-03-07 07:18:30 +0800 )edit

answered 2014-03-07 07:17:27 +0800

venicum gravatar image venicum
21 4

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"
                                            mold="paging" pageSize="20" >
                                                <listheader label="№" width="50px" align="center" />
                                                    label="Тип документа" sort="auto" width="100%" />
                                                <listheader label="НПФ"
                                                    sort="auto" align="center" width="150px" />
                                                    label="Статус" sort="auto" width="100px" align="center" />
                                                    label="Время изменения" sort="auto" align="center"
                                                    width="130px" />
                                            <template name="model">
                                                <listitem height="50px">
                                                        label="${forEachStatus.index + 1}" />
                                                        label="${each.type}" />
                                                        label="${each.npf}" />
                                                        label="${each.status}" />
                                                        label="${each.updateTime}" />
link publish delete flag offensive edit


It looks like this demo http://www.zkoss.org/zkdemo/listbox/multiple_selection (listbox Zk demo) with checkmark=true, multiple=false. And in this demo I haven't see any "checkall" button.

venicum ( 2014-03-07 07:20:02 +0800 )edit

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

Thank you for example. Yes, I copied your source and it doesn't work for me. This code is result of my tests where I already deleted "custom-attributes" tag. I also tried set this property in zk.zul ineffectively.

venicum ( 2014-03-07 09:10:30 +0800 )edit

Furhermore, I just copy-paste example from http://www.zkoss.org/zkdemo/listbox/multiple_selection and it's work correctly (without ROD).

venicum ( 2014-03-07 09:11:07 +0800 )edit

does the example work for you on ZK fiddle?

cor3000 ( 2014-03-07 10:13:19 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2014-03-06 11:26:29 +0800

Seen: 54 times

Last updated: Mar 07 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More