How to disable listitem

asked 2017-10-17 21:10:58 +0800

tom303003 gravatar image tom303003

Is it possible disable only one row of listbox after clicking on button without ID?

delete flag offensive retag edit


can you explain more? are you using mvc, mvvm? maybe create a fiddle with your setup.

chillworld ( 2017-10-18 15:20:27 +0800 )edit

i want to disable only one row in listbox after clicking on button but all listbox is filled dynamicly from database <listbox id="ColorGrid" apply="sk.trilobit.slevyk.v2.controller.WorkModelViewModel" model="@load(mevm.workModelList)" mold="paging" pageSize="10" selectedItem="@

tom303003 ( 2017-10-18 15:51:53 +0800 )edit

http://zkfiddle.org/sample/da2fse/1-listbox this

tom303003 ( 2017-10-18 15:54:13 +0800 )edit

https://imgur.com/a/6eEBt here is the image

tom303003 ( 2017-10-18 15:56:28 +0800 )edit

1 Answer

Sort by » oldest newest most voted

answered 2017-10-19 13:37:00 +0800

chillworld gravatar image chillworld flag of Belgium
5322 4 9

Well you are using MVVM.
There is a simple solution for that.

First of all, create a Wrapper object around your modelObject like this :

private boolean editable = false;
private MyModelObject model;

//constructor + getters and setters.

Now you can use the boolean to switch to correct layout in the zul (I hope it's correct, cant test it atm):

<listbox id="ColorGrid" apply="sk.trilobit.slevyk.v2.controller.WorkModelViewModel" model="@load(mevm.workModelList)" mold="paging" pageSize="10"
                 selectedItem="@bind(mevm.selectedWorkModel)" height="auto">
<template name="model">
                  <zk if="${not each.editable}">
                    <listcell label="@load(each.model.name)"/>
                    <listcell label="@load(each.model.color)"/>
                    <listcell><label value="@load(each.model.norma) @converter('formatedNumber', format='###,##0.0')"/></listcell>
                        <button image="images/yes.png" if="${sec:isAllGranted('ROLE_AV')}"
                                mold="trendy" tooltiptext="Aktivovať"/>
                        <button image="images/delete.png" if="${sec:isAllGranted('ROLE_AV')}" mold="trendy"
                                onClick="@command('delete', workModel=each.model)"
                        <button image="images/list.png" mold="trendy"
                                onClick="@command('open', pageName='v2/workModelItem.zul',workModel=each.model)"
                <zk if="${each.editable}">

link publish delete flag offensive 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: 2017-10-17 21:10:58 +0800

Seen: 7 times

Last updated: Oct 19 '17

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