-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4903499
By: nalin1279
Hi all,
i've got a question about onOk event.
there is 2 window component in my zull page.
the first window is used to set some search parameters.
the second result is used to dislay the result in a grid.
In both windows i set the onOk properties : in the first window onOk is used to submit my form to the server and to set the result grid of my second window, and it works well.
In the second window, there is a datebox use to find a specific result by date in my grid. i try to set the onOk event on my datebox, but nothing append when i focus my datebox and then click on enter key.
then i try to set the onOk on my second window or, on the grid itself ... but nothing still append when i press enter key.
Can someone explain me why ?
thx
mickael
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4903551
By: jumperchen
Hi Mickael,
Could you provide a simple sample?
BTW, which ZK version and browser do you use?
Thanks,
Jumper
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4903913
By: madruga0315
Hey Mickael,
In your description, you said onOk event, and this event does not exist, the correct is onOK (OK both letters uppercase).
So it may be a miss type.
/Madruga
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4903933
By: nalin1279
Hi,
here is a sample code :
first focus the textbox of the first window and press enter key, then a popup appears, all works.
then focus the datebox of the second window, and press enter key, nothing append.
the zk version used is : 3.0.3 and i can't migrate to the 3.0.4 version because we are about to put the application on our production environnement, so we can not spend 2 weeks to test the all application.
the IE version is : 6.0.2900
thx all
<?xml version="1.0" encoding="UTF-8"?>
<zk xmlns:p="http://www.zkoss.org/2005/zul" xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:zk="http://www.zkoss.org/2005/zk"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.zkoss.org/2005/zul
http://www.zkoss.org/2005/zul/zul.xsd">
<window title="wnd1" border="normal" onOK="doOkWnd1()">
<textbox value="submit"/><space/>
<button label="go"/>
</window>
<separator/><separator/>
<window title="wnd2" border="normal" onOK="doOkWnd2">
<datebox id="winfocus" /><space/>
<button label="go"/>
</window>
<zscript>{
void doOkWnd1() {
Messagebox.show("ENTER key is pressed wnd1", "OK", Messagebox.OK, Messagebox.EXCLAMATION);
}
void doOkWnd2() {
Messagebox.show("ENTER key is pressed wnd2", "OK", Messagebox.OK, Messagebox.EXCLAMATION);
}
}</zscript>
</zk>
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4903953
By: madruga0315
Hey,
You forgot the parenthesis of the method in this line:
<window title="wnd2" border="normal" onOK="doOkWnd2">
Just put the open and close parenthesis in the doOkWnd2
like this
<window title="wnd2" border="normal" onOK="doOkWnd2()">
Worked in zkdemo.
Madruga
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4903988
By: nalin1279
Exact, in my sample code i forget the parenthesis ^^
the sample code works.
But i check my code, i dont forget anything, and it doesn't work.
i know you can not test the code bellow, but maybe can you tell my where is the fox.
<?init class="org.zkforge.yuiext.zkplus.databind.AnnotateDataBinderInit" ?> <?init zscript="/WEB-INF/views/zs/init/commons.zs"?>
<?page id="page-quote-results"?>
<zk xmlns:p="http://www.zkoss.org/2005/zul" xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:zk="http://www.zkoss.org/2005/zk"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.zkoss.org/2005/zul
http://www.zkoss.org/2005/zul/zul.xsd" xmlns:y="http://www.zkoss.org/2007/yui">
<separator height="10px"/>
<variables dbo="${dbo}" showgrid="${showGrid}"/>
<window id="win-quote" title="Intraday Results" border="normal" width="100%"
context="commandement" onCreate="init()">
<zscript>
import java.util.Vector;
import java.lang.Boolean;
import com.sgam.webapp.horus.web.zk.component.utils.HorusDateFormater;
import com.sgam.webapp.horus.spring.business.dbo.intraday.impl.IntradayDBOImpl
;
import com.sgam.webapp.horus.spring.model.dto.intraday.IntradayQuoteDTO;
import com.sgam.webapp.horus.web.zk.component.utils.IntervalTimeBoxConstraint;
import java.util.Map;
import java.util.HashMap;
import com.sgam.webapp.horus.web.zk.component.quote.renderer.IntradayRenderer;
IntradayRenderer renderer = new IntradayRenderer();
Vector intradays = dbo.getIntradayQuoteList();
self.getPage().setVariable("dbo", dbo);
boolean isIntradaysEmpty = intradays == null ? true : intradays.isEmpty();
int size = intradays == null ? 0 : intradays.size();
String startDate = null;
String endDate = null;
IntervalTimeBoxConstraint timeboxConstaint = null;
if(!isIntradaysEmpty){
startDate = ((IntradayQuoteDTO)intradays.get(intradays.size()
-1)).getTimestamp();
endDate = ((IntradayQuoteDTO)intradays.get(0)).getTimestamp();
timeboxConstaint = new IntervalTimeBoxConstraint(startDate, endDate);
}
void init(){
if(!isIntradaysEmpty){
if(!showgrid){
btnChart.setTooltiptext("get data grid");
btnChart.setImage("/images/chart2.jpg");
}
else{
btnChart.setTooltiptext("get chart");
btnChart.setImage("/images/chart.jpg");
}
}
}
<![CDATA[
void searchIntraday(Vector intradaysVector){
int pos = 0;
if(tbIntraday.getValue() == null){
alert("please, select an hour");
}
else{
String strHour = tbIntraday.getText() + ":00";
for(int i = 0; i < intradaysVector.size(); i++){
IntradayQuoteDTO tmpIntraday = intradaysVector.get(i);
if(tmpIntraday.getTimestamp().indexOf(strHour) != -1){
pos = i == 0 ? 0 : i+1;
break;
}
}
int desiredPage = 0;
if(pos != 0){
int modulo = pos % quoteGrid.getPageSize();
desiredPage = modulo == 0 ? (pos / quoteGrid.getPageSize())-1 : pos / quoteGrid.getPageSize();
}
quoteGrid.getPaging().setActivePage(desiredPage);
quoteGrid.selectRow(pos);
}
}
void exportData(){
Map params = new HashMap();
String url = "/WEB-INF/views/zul/intraday/popup/export-popup.zul";
Window win = (Window) Executions.createComponents(url, null, params);
win.doModal();
}
void handleGraph(){
Window paramWindow
= self.getDesktop().getPage("page-quote-view").getFellow("ticker-quote-win");
Textbox hdShowGrid = paramWindow.getFellow("hdShowGrid");
if(gridDiv.isVisible()){
lbQuoteCaption.setVisible(false);
tbIntraday.setVisible(false);
btIntraday.setVisible(false);
btnChart.setImage("/images/chart2.jpg");
btnChart.setTooltiptext("get data grid");
hdShowGrid.setValue("false");
}
else{
lbQuoteCaption.setVisible(true);
tbIntraday.setVisible(true);
btIntraday.setVisible(true);
btnChart.setImage("/images/chart.jpg");
btnChart.setTooltiptext("get chart");
hdShowGrid.setValue("true");
}
gridDiv.setVisible(!gridDiv.isVisible());
chartDiv.setVisible(!chartDiv.isVisible());
}
]]>
</zscript>
<caption width="100%">
<hbox valign="center" if="${isIntradaysEmpty == false}">
<label value="select a specific hour : " class="labelTitle" if="${size > 0}" id="lbQuoteCaption" visible="${showgrid}"/>
<timebox id="tbIntraday" constraint="${timeboxConstaint}" visible="${showgrid}"
onOK="searchIntraday(intradays)"/>
<button id="btIntraday" image="/images/search-icon.jpg"
onClick="searchIntraday(intradays)" tooltiptext="search by hour"
visible="${showgrid}"/>
<label value="|" class="labelTitle"/>
<button image="/images/chart.jpg" width="30px" height="26px" tooltiptext="get chart" id="btnChart" onClick="handleGraph()"/>
<label value="|" class="labelTitle"/>
<button image="/images/excel.jpg" width="26px" height="26px"
onClick="exportData()"/>
</hbox>
</caption>
<separator/>
<script type="text/javascript">
<![CDATA[
function doExport(url) {
document.location = url.value;
}
]]>
</script>
<div id="chartDiv" visible="${!showgrid}" align="center" width="98%"
if="${isIntradaysEmpty == false}">
<include src="/WEB-INF/views/zul/intraday/graph/intraday-graph.zul"/>
</div>
<div id="gridDiv" width="100%" visible="${showgrid}">
<QuoteGrid id="quoteGrid" data="${intradays}" rowRenderer="${renderer}"
width="100%" mold="paging" pageSize="40" if="${isIntradaysEmpty == false}">
<columns>
<column label="Timestamp" width="20%"/>
<column label="Open" width="12%"/>
<column label="High" width="12%"/>
<column label="Low" width="12%"/>
<column label="Close" width="12%"/>
<column label="Volume" width="12%"/>
<column label="Timerange" width="10%"/>
<column label="Ticksnumber" width="10%"/>
</columns>
</QuoteGrid>
</div>
<div align="center" unless="${isIntradaysEmpty == false}">
<separator height="10px"/>
<label value="Nothing found to display" visible="true" class="alertlabel"/>
</div>
</window>
</zk>
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4949428
By: devinder
I have window embeded in zhtml, how can I make onOK to work?
<zk:window id="win" use="AdvancedSearchWindow">
<tr>
<td class="Username">Keywords:</td>
<td><zk:textbox id="tbkeyskills" value="@{objJobSearchData.keyskills}"
maxlength="200" width="280px" constraint="no empty" /><br />
</tr>
<tr>
<td class="Username">Experience:</td>
<td>
<zk:label value="Min."/>
<zk:intbox id="ibexperiencemin" value="@{objJobSearchData.minExperience}"
width="50px"/>
<zk:label value="Max."/>
<zk:intbox id="ibexperiencemax" value="@{objJobSearchData.maxExperience}"
width="50px"/>
</td>
</tr>
<tr>
<td colspan="2" align="center"> <zk:button label="Search"
forward="win.onOK"/></td>
</tr>
</zk:window>
The AdvancedSearchWindow
public class AdvancedSearchWindow extends Window{
public void onOK() {
JobSearchData objJobSearchData = (JobSearchData)
this.getPage().getVariable("objJobSearchData");
jp.util.Util.doResumeSearch(objJobSearchData);
}
}
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4959896
By: waterbottle
following code works for me.( the code you posted is typo and not a valid XHTML <window with <tr , to <table ??)
<html xmlns:zk="http://www.zkoss.org/2005/zul">
<body>
<zk:window id="win" onOK='alert("ok!!")'> <table> <tr> <td class="Username">Keywords:</td> <td><zk:textbox id="tbkeyskills" maxlength="200" width="280px" constraint="no empty" /><br /> </td> </tr> <tr> <td class="Username">Experience:</td> <td> <zk:label value="Min."/> <zk:intbox id="ibexperiencemin" width="50px"/> <zk:label value="Max."/> <zk:intbox id="ibexperiencemax" width="50px"/> </td> </tr> <tr> <td colspan="2" align="center"> <zk:button label="Search" forward="win.onOK"/></td> </tr> </table> </zk:window> </body> </html>
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4960616
By: devinder
It worked. Thanks for reply.
regards
Devinder
Asked: 2008-04-14 08:09:08 +0800
Seen: 1,186 times
Last updated: May 13 '08