0

Grid dynamic with radiogroup, how set onCheck

asked 2006-04-06 03:49:16 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3671963

By: julgarso72

Hi.

I made a grid wich dynamically creates a number of rows. It work Ok. This is the code:

<grid>
<columns>
<column label="Fecha"/>
<column label="Actividad" width="500px"/>
<column label="Tiempo" width="220px"/>
</columns>
<rows id="idRows">
<zscript><![CDATA[
int n=0;
Row row;
Datebox datebox;
Hbox hbox;
Radiogroup radiog;
Radio ra;
Textbox tb;
Intbox ib;
for(n=0;n<=30;n++)
{
row = new Row();
row.setParent(idRows);

datebox = new Datebox();
datebox.setFormat("dd/MM/yyyy");
datebox.setId("dbHojaFecha"+n);
datebox.setParent(row);

tb = new Textbox();
tb.setId("tbHoja"+n);
tb.setWidth("99%");
tb.setParent(row);

hbox = new Hbox();
hbox.setParent(row);

radiog = new Radiogroup();
radiog.setParent(hbox);
radiog.setId("raHoja"+n);

ra = new Radio();
ra.setParent(radiog);
ra.setLabel("Dia");
ra = new Radio();
ra.setParent(radiog);
ra.setLabel("1/2");
ra = new Radio();
ra.setLabel("Horas");
ra.setParent(radiog);

ib = new Intbox();
ib.setId("ibHojaHora"+n);
ib.setParent(hbox);
ib.setVisible(false);
}
]]></zscript>

The code works fine, generate the 30 rows with 3 columns, a date, a textbox and 3 radios.

Before, I had the follow code that generate one row:

<row> <datebox format="dd/MM/yyyy" id="dbHoja01"/>
<textbox id="tbHoja01" width="99%"/>
<hbox>
<radiogroup id="Ra01"
onCheck="checkRadio(ibHojaHora01)">
<radio label="Dia" id="raHojaDia01"/>
<radio label="1/2" id="raHojaDim01"/>
<radio label="Horas" id="raHojaHoras"/>
</radiogroup>
<intbox id="ibHojaHora01" visible="false"
width="60%"/>
</hbox>
</row>

This code repeates for each row to generate.

I replaced the before code by the zscript, but I need when the radio "Horas"
id raHojasHoras be checked, the intbox be show, and when don't be checked, the intbox be hide and put zero.
The onCheck call this script:

void checkRadio(Intbox ib) {
if (raHojaHoras.isSelected())
ib.setVisible(true);
else {
ib.setVisible(false);
ib.setValue(0);
}
}

How can I do on the script wich creates dynamically the rows, call the checkRadio(Intbox ib) script when the radio "Horas" be checked?

If I copy and paste the code that generate a row (not the zscript <![CDATA...) and change the id's all work fine, but will be a lot of lines of code, for thah I want create a script and create the rows dynamically and changing the counter determinate how rows create.

Thanks.


delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2006-04-06 04:19:32 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3671982

By: henrichen

Please see Developer's Guide, chap5, section "Add and Remove Event Listeners by Program"

There is a relative example in demo:

http://www.potix.com/zkdemo/userguide/?id=e4

/henri

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: 2006-04-06 03:49:16 +0800

Seen: 752 times

Last updated: Apr 06 '06

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