zkzk-grid

get value checkbox in zk


i have a grid with list checkbox

    <div height="200px">
<grid id ="actListBox" model="@bind(vm.actions)" >
<template name="model">
<row style=" width:200px !important; ">
    <cell rowspan="5" align="left" >
      <checkbox style="height: 70px; width:1000px; overflow: auto;   margin-left:10px;" 
      label="${each.action_name}" id ="${each.actionid}" value ="${each.actionid}"  />
     </cell>
</row>
</template>
</grid>
<span>
<checkbox label="Check all" value ="checkall" id="chkAll"/>
</span>
</div>

and now i want get all value of checkbox but i can't found anyway please help me thanks all


Solution

  • You can in your composer get checked Ids by iterating over actions:

    @Command
    public void checkedIds(final Event e){
        final StringBuilder builder = new StringBuilder("Checked Ids: ");
        for (final Action action : actions) {
            if (action.getChecked()) {
                builder.append(action.getId()).append(' ');
            }
        }
        Messagebox.show(builder.toString());      
    }
    

    I updated the ZK fiddle.