0

How to set checked of checkbox of listbox listcell

asked 2016-10-17 21:27:52 +0800

scottz gravatar image scottz
1

We've got a grouped grid/listbox and I'm attempting to add a checkbox to each group that will select/deselect all members of that group (ideally I will also uncheck the group's checkbox if the user unsets the checkbox of a group member after selecting the group checkbox). There's probably an easier way to set this up, and if there is, I'd love to hear it. I've been able to navigate through the element tree and find out if a listitem is checkable, but I've not been able to find anything that will let me set the check state of a listitem in a listbox that is selectable.

The main question I have is: is there a way to navigate through the below structure through an oncheck method for the group checkbox that will let me set/unset the checked status of the listitems.

The .zul is below:

        <grid model="@bind(vm.groupList)"
              vflex="1"
              mold="paging"
              emptyMessage="No groups"
              autopaging="false" >
            <rows>
                <template name="model" var="item">
                    <row onDoubleClick="@command('edit', messageGroup = item)" onClick="@command('selectItem',messageGroup=item, target=self)">
                        <checkbox id="@load(item.groupId)" label="@load(item.groupName)" onCheck="@command('selectGroup', checkBox=self, group=item.groupName)" />
                        <detail onOpen="" onDoubleClick="">
                            <listbox model="@load(vm.getGroupUsers(item))" 
                                    multiple="true" 
                                    checkmark="true" 
                                    selectedItems="@bind(vm.selectedUsers)" 
                                    nonselectableTags="*">
                                <template name="model" >
                                    <listitem>
                                        <listcell label="@load(vm.getPartyFullNameWithRank(each.user.party))" />
                                    </listitem>
                                </template>
                                <listfoot>
                                    <listfooter label="Total: " align="left">
                                        <label value="@load(vm.reload(item).messageGroupUsers.size())" style="font-weight:bold"/>
                                    </listfooter>
                                </listfoot>
                            </listbox>
                        </detail>
                    </row>
                </template>
            </rows>
        </grid>
delete flag offensive retag edit
Be the first one to answer this question!
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

Follow
1 follower

RSS

Stats

Asked: 2016-10-17 21:27:52 +0800

Seen: 21 times

Last updated: Oct 17 '16