0

Issue with ZK Checkbox?

asked 2012-09-11 09:42:40 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

Hi i have a macro Component for DualListBox which also contains the Checkbox..Something Like this...

<zk>
	<hlayout
		style="padding-left: 40px;padding-top:20px;padding-bottom:20px;"
		hflex="1" vflex="1">
		<separator />

		<listbox id="candidateLb" vflex="true" width="250px"
			multiple="true"   model="${arg.candidateModel}">
			<listhead>
				<listheader label="Default Column List"></listheader>

			</listhead>
			<template name="model" var="each">
				<listitem>
					<listcell label="${each}" />

				</listitem>
			</template>
		</listbox>

		<vbox spacing="10px">
			<image style="cursor:pointer" id="chooseAllBtn"
				src="/images/rightrightarrow_g.png" />
			<image style="cursor:pointer" id="chooseBtn"
				src="/images/rightarrow_g.png" />
			<image style="cursor:pointer" id="removeBtn"
				src="/images/leftarrow_g.png" />
			<image style="cursor:pointer" id="removeAllBtn"
				src="/images/leftleftarrow_g.png" />
		</vbox>
		<listbox id="chosenLb" vflex="true" width="250px"
			  model="${arg.chosenDataModel}" >
			<listhead>
				<listheader label="Selected Column List"></listheader>

			</listhead>
			<template name="model" var="each">
				<listitem>
				 
					<listcell label="${each.value}" >
					<separator orient="vertical"  />
					
                <b >    <checkbox checked="${each.checked}" /></b>
                    </listcell>
				</listitem>
			</template>
		</listbox>

		<vbox spacing="10px">
			<image style="cursor:pointer" id="topBtn"
				src="/images/upuparrow_g.png" />
			<image style="cursor:pointer" id="upBtn"
				src="/images/uparrow_g.png" />
			<image style="cursor:pointer" id="downBtn"
				src="/images/downarrow_g.png" />
			<image style="cursor:pointer" id="bottomBtn"
				src="/images/downdownarrow_g.png" />
		</vbox>

	</hlayout>
</zk>

My Problem is that when some one checked the CheckBox i want to call a method which will update some value...How can i do this.
thanks

delete flag offensive retag edit

31 Replies

Sort by ยป oldest newest

answered 2012-10-01 04:51:27 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

Yes jimmyshiau,
Thanks but i did it.
thanks

link publish delete flag offensive edit

answered 2012-10-01 02:11:25 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

Hi sjoshi,

CheckBox has no inplace attribute, you need to switch by yourself.

link publish delete flag offensive edit

answered 2012-09-14 10:47:38 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

updated 2012-09-14 10:48:16 +0800

Hi JJ,
I am asking , something Like This. inplace="true" is available for CheckBox also.
thanks

link publish delete flag offensive edit

answered 2012-09-14 05:08:45 +0800

jj gravatar image jj
638 3

YOur solution should work. Without understanding your business logic, I think You could attach the data as a value to a listitem, and then you can just set it directly

e.g.

listitem.setValue(data);


or
<listitem value="${each.data}" />

then in your method, you can just find the listitem for the checkbox, and get the data, then set it.

Not sure about your meaning of inline editing checkbox?

link publish delete flag offensive edit

answered 2012-09-14 04:35:43 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

Hi Do you have any other Solution.
thanks

link publish delete flag offensive edit

answered 2012-09-13 05:46:51 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

Hi
I found his Solution of above Posted Problem Please let me know if You have some other Solution.

	public void onMyChecked(ForwardEvent evt) {
    
        Checkbox cb = (Checkbox)evt.getOrigin().getTarget();
     
        Listcell lstCell = (Listcell)cb.getParent();
        
        List<Data> list = getChosenDataList();
        ListModelList<Data> chosenDataModel= new ListModelList<Data>();
        for(Data data : list){
        	if(data.getValue().equals(lstCell.getLabel())){
        		data.setChecked(cb.isChecked());
        		chosenDataModel.add(data);
        	}else{
        		chosenDataModel.add(data);
        	}
        }
        setChosenDataModel(chosenDataModel);
    }

But i want to know if ZK Provide Inline Editing for Checkbox also as they are providing for textbox.
thanks

link publish delete flag offensive edit

answered 2012-09-13 05:00:23 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

Hi Stephan and JJ ,
By using forward we can know that checkbox is checked or not but how can we know data for which it is being checked ?
Is there any solution like Inline row editing?

link publish delete flag offensive edit

answered 2012-09-13 02:13:54 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

Ok let me see how can i will do it ..will let you know if i will achieve this .
thanks

link publish delete flag offensive edit

answered 2012-09-13 02:12:24 +0800

jj gravatar image jj
638 3

I would maintain a list of Checkbox states in DualListBox, and update corresponding checkbox checked status when onMyChecked is called. This way, you have the information on all the checkboxes.

link publish delete flag offensive edit

answered 2012-09-13 01:40:47 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

Thanks JJ Stephen,
It work for me but one question let us suppose in Right hand side i have no item..
1-Now i added two checkbox and check one Chekbox and did not check second one in java how i wil know i have another checkbox which is not cheked by user. Because..

forward="onCheck=onMyChecked"

Will work when someone check the Chekbox,,,I want to know which is uncheked also ..In my case Unchcked means users want Descending order for that column and Cheked means user wants Ascending Order...

THanks

link publish delete flag offensive edit
Your reply
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

RSS

Stats

Asked: 2012-09-11 09:42:40 +0800

Seen: 919 times

Last updated: Oct 01 '12

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