Processing...

Suggested case list:

Using timer to refresh a grid

383guest172.69.33.12125nk0uiMay 7, 2020 7:23:47 AMlink

user model to move item to another listbox

120guest162.158.193.148d0n3krApr 2, 2020 5:28:28 AMlink

Disabled list item row passed to VM-1981

296fatih123160.83.36.13025nk0uiFeb 13, 2018 4:25:44 PMlink

Disabled list item row passed to VM-1981

295fatih123160.83.36.13025nk0uiFeb 13, 2018 4:25:16 PMlink

Disabled list item row passed to VM-1981

294fatih123160.83.36.13225nk0uiFeb 13, 2018 3:30:44 PMlink

grid sample with ListModel/RowRenderer

816guest80.82.2.1312vah9ajFeb 21, 2017 11:42:21 AMlink

grid sample with ListModel/RowRenderer

809guest175.98.113.1622vah9ajJan 26, 2017 9:19:33 AMlink

grid sample with ListModel/RowRenderer

196guest79.185.142.402vah9ajApr 26, 2014 10:53:57 PMlink

grid sample with ListModel/RowRenderer

195guest79.185.142.402vah9ajApr 26, 2014 10:53:54 PMlink

grid sample with ListModel/RowRenderer

194guest79.185.142.402vah9ajApr 26, 2014 10:53:51 PMlink

grid sample with ListModel/RowRenderer

193guest79.185.142.402vah9ajApr 26, 2014 10:53:48 PMlink

grid sample with ListModel/RowRenderer

192guest79.185.142.402vah9ajApr 26, 2014 10:53:44 PMlink

grid sample with ListModel/RowRenderer

191guest79.185.142.402vah9ajApr 26, 2014 10:53:40 PMlink

Hierarchy table without using ZK PE/EE

1aaknai151.28.135.2131s871daJul 29, 2013 11:02:46 PMlink

grid sample with ListModel/RowRenderer

128aaknai151.28.135.2132vah9ajJul 29, 2013 7:20:00 PMlink

user model to move item to another listbox

1TonyQ114.25.109.94d0n3krApr 21, 2012 10:43:27 AMlink

Using timer to refresh a grid

1TonyQ220.133.44.3725nk0uiFeb 17, 2012 3:17:34 AMlink

Fire a event from child iframe

1TonyQ220.133.44.372eupjotFeb 3, 2012 5:04:52 AMlink

Textbox input restriction sample

1TonyQ72.21.245.2431b3nlr0Dec 20, 2011 10:09:10 AMlink

Test web core taglib in ZUL

1TonyQ198.203.175.175ofqkemDec 17, 2011 3:36:08 AMlink

Latest 10 Fiddles :

constraint binding textbox

3guest172.68.151.16220peldaDec 5, 2025 5:08:19 PMlink

Another new ZK fiddle

2guest172.68.151.16320peldaDec 5, 2025 5:07:51 PMlink

Another new ZK fiddle

1guest172.68.151.16220peldaDec 5, 2025 5:07:32 PMlink

Another new ZK fiddle

1peggypeng172.71.154.99364f4neDec 5, 2025 9:24:31 AMlink

tooltip example

2guest104.22.23.13rc1ntoDec 4, 2025 2:23:45 PMlink

Another new ZK fiddle

1guest172.69.134.2277t7602Dec 4, 2025 1:40:46 PMlink

Another new ZK fiddle

1peggypeng104.22.17.1802df6e3oDec 4, 2025 8:41:29 AMlink

onClose

1peggypeng172.68.87.248j8kd8aDec 3, 2025 4:10:26 AMlink

Another new ZK fiddle

1peggypeng172.69.134.2271rm7f4eNov 26, 2025 3:31:24 AMlink

ZK-5912-Suggestion

2rebeccalai104.22.20.1442qrmiiuNov 26, 2025 2:07:15 AMlink

Another new ZK fiddle

19Prashant172.71.186.453rbqcmaJul 6, 2023 11:59:10 AMlink

resources

index.zulzul <zk> <window id="REP_Outward_OACK" title="REP_Outward_OACK" apply="pkg$.com.imageinfo.eclear.v2.webapp.ajax.reportControllers.REP_Outward_OACK" sclass="expstyle1" contentStyle="overflow:auto;position:relative" height="100%"> <style> .expstyle1 .z-window-modal-tl, .expstyle1 .z-window-modal-tr, .expstyle1 .z-window-modal-tm, .expstyle1 .z-window-modal-cl, .expstyle1 .z-window-modal-cr, .expstyle1 .z-window-modal-cm, .expstyle1 .z-window-modal-bl, .expstyle1 .z-window-modal-br, .expstyle1 .z-window-modal-bm, .expstyle1 .z-window-modal-hl, .expstyle1 .z-window-modal-hr, .expstyle1 .z-window-modal-hm { background: #007DC8; } .expstyle1 .z-window-modal-header { background: #007DC8; } </style> <div id="detailedDiv" width="100%" height="10%"> <grid id="detailedgrid" align="center"> <columns> <column align="right" width="7%"></column> <column align="left" width="10%"></column> <column align="right" width="5%"></column> <column align="left" width="10%"></column> <column align="right" width="9%"></column> <column align="left" width="12%"></column> <column align="right" width="10%"></column> <column align="right" width="12%"></column> <column align="right" width="10%"></column> <column align="right" width="10%"></column> </columns> <rows> <row width="100%"></row> <row width="100%"></row> <row align="center" width="100%"> <label value="From Date :"></label> <datebox id="detaileddb1" width="110px"></datebox> <label value="To Date :"></label> <datebox id="detaileddb2" width="120px"></datebox> <label value="Clearing Type :"></label> <combobox id="clearingtypecb" width="120px" readonly="true"> </combobox> <label value="Grid :"></label> <combobox id="grid" width="120px" readonly="true"> </combobox> <button id="detailedreport" mold="trendy" label="Create"> </button> <button id="downloadbtn" mold="trendy" visible="true" label="Download"> </button> </row> </rows> </grid> </div> </window> </zk>REP_Outward_OACK.javajavaimport java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStream; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import javax.naming.InitialContext; import javax.servlet.http.HttpSession; import javax.sql.DataSource; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.DataFormat; import org.apache.poi.xssf.streaming.SXSSFSheet; import org.apache.poi.xssf.streaming.SXSSFWorkbook; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.Sessions; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.util.GenericForwardComposer; import org.zkoss.zul.Button; import org.zkoss.zul.Combobox; import org.zkoss.zul.Datebox; import org.zkoss.zul.Div; import org.zkoss.zul.Filedownload; import org.zkoss.zul.Grid; import org.zkoss.zul.Window; //import com.imageinfo.eclear.v2.utils.Globals; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Row; @SuppressWarnings({ "unchecked", "rawtypes" }) public class REP_Outward_OACK extends GenericForwardComposer { private static final long serialVersionUID = 1L; Button convert; HttpSession s; Window REP_Outward_OACK; Div detailedDiv; Grid detailedgrid; Datebox detaileddb1; Datebox detaileddb2; Button detailedreport; Button downloadbtn; String TxnDate1 = ""; String TxnDate2 = ""; String bcode = ""; String QueryString = ""; String sess_usr; String curDate; static String export_path = ""; Combobox formatcb, clearingtypecb; String filename = ""; HashMap<String, Object> msgparamscon = new HashMap<String, Object>(); public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp); s = (HttpSession) Sessions.getCurrent().getNativeSession(); try { s.getAttribute("svalid").toString().toUpperCase(); } catch (NullPointerException npe) { Executions.sendRedirect("/invalid.zul"); return; } REP_Outward_OACK.setTitle("Outward OACK Report"); REP_Outward_OACK.setBorder("normal"); REP_Outward_OACK.setSizable(false); detaileddb1.setFormat("dd-MMM-yyyy"); detaileddb2.setFormat("dd-MMM-yyyy"); Connection conn = null; Statement stmt1 = null; ResultSet rs = null; try { curDate = s.getAttribute("currentdate").toString(); sess_usr = (String) s.getAttribute("usern"); detaileddb1.setText(curDate); detaileddb2.setText(curDate); Date d = (new SimpleDateFormat("dd-MMM-yyyy")).parse(curDate); String s2 = (new SimpleDateFormat("yyyyMMdd")).format(d); detaileddb1.setConstraint("before " + s2); detaileddb2.setConstraint("before " + s2); detailedreport.addEventListener("onClick", detaileddisplayevent); clearingtypecb.appendItem("ALL"); // DataSource ds = (DataSource) new InitialContext(Globals.getICProps()).lookup(Globals.getDSlookup()); // conn = ds.getConnection(); stmt1 = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY); rs = stmt1.executeQuery("select lpad(clearing_type,2,'0')||'-'||description as clearing_type from tbl_clearing_type where active_status = 'E' order by clearing_type"); while (rs.next()) { clearingtypecb.appendItem(rs.getString("clearing_type")); } rs.close(); rs = null; clearingtypecb.setSelectedIndex(0); } catch (Exception e) { e.printStackTrace(); } finally { // try { if (rs != null) { rs.close(); rs = null; } if (stmt1 != null) { stmt1.close(); stmt1 = null; } if (conn != null) { conn.close(); conn = null; } } catch (Exception fe) { Globals.setLog(fe); } } downloadbtn.addEventListener("onClick", linklistener); } EventListener linklistener = new EventListener() { public void onEvent(Event event) throws Exception { if ("onClick".equalsIgnoreCase(event.getName())) { try { fileDownload(export_path, filename); } catch (Exception e) { e.printStackTrace(); // Globals.setLog(e); } } } }; public void fileDownload(String srcpath, String filename) { try { InputStream is = new FileInputStream(new File(srcpath + "/" + filename)); if (is != null) { Filedownload.save(is, "xlsx", filename); } } catch (FileNotFoundException e) { e.printStackTrace(); // Globals.setLog(e); } } EventListener detaileddisplayevent = new EventListener() { public void onEvent(Event arg0) throws Exception { if (arg0.getTarget().getId().equalsIgnoreCase("detailedreport")) { if (detaileddb1.getText() == "" || detaileddb1.getText() == null) { try { HashMap<String, String> msgparams = new HashMap<String, String>(); msgparams.put("msgstring", "Above Options Must be Selected........."); Window win = (Window) Executions.createComponents("MessageBox.zul", REP_Outward_OACK, msgparams); win.doModal(); } catch (Exception e) { } return; } else if (detaileddb2.getText() == "" || detaileddb2.getText() == null) { try { HashMap<String, String> msgparams = new HashMap<String, String>(); msgparams.put("msgstring", "Above Options Must be Selected........."); Window win = (Window) Executions.createComponents("MessageBox.zul", REP_Outward_OACK, msgparams); win.doModal(); } catch (Exception e) { } return; } else if (clearingtypecb.getValue() == "" || clearingtypecb.getValue() == null) { try { HashMap<String, String> msgparams = new HashMap<String, String>(); msgparams.put("msgstring", "Please select clearing type........."); Window win = (Window) Executions.createComponents("MessageBox.zul", REP_Outward_OACK, msgparams); win.doModal(); } catch (Exception e) { } return; } // for XLSX String op = ""; op = generateExportExlFile(detaileddb1.getText(), detaileddb2.getText(), clearingtypecb.getValue(),false); if (op.equalsIgnoreCase("OK")) { try { HashMap<String, String> msgparams = new HashMap<String, String>(); msgparams.put("msgstring", "Report generated Successfully"); Window win = (Window) Executions.createComponents("MessageBox.zul", null, msgparams); win.doModal(); downloadbtn.setVisible(true); } catch (Exception e) { // Globals.setLog(e); } return; } else { try { HashMap<String, String> msgparams = new HashMap<String, String>(); msgparams.put("msgstring", op); Window win = (Window) Executions.createComponents("MessageBox.zul", null, msgparams); win.doModal(); downloadbtn.setVisible(false); } catch (Exception e) { // Globals.setLog(e); } return; } } } }; public String generateExportExlFile(String fromdate, String ToDate, String clearingtype, boolean eod) { Row row = null; ResultSet rs1 = null; Connection conn = null; PreparedStatement pstmt1 = null; try { // DataSource ds = (DataSource) new InitialContext(Globals.getICProps()).lookup(Globals.getDSlookup()); // conn = ds.getConnection(); String whereclause = "where transaction_date between '" + fromdate + "' and '" + ToDate + "'"; if(eod) { // export_path = Globals.getAttribute("EOD_PATH"); } else { // export_path = Globals.getAttribute("REPORTS_PATH"); } if (!(clearingtype.equalsIgnoreCase("ALL") || clearingtype.equalsIgnoreCase(""))) { String str = clearingtype.substring(0, 2); if("01".equalsIgnoreCase(str)) whereclause += " AND clearing_zone_code='01'"; else if("11".equalsIgnoreCase(str)) whereclause += " AND clearing_zone_code='11'"; else if("99".equalsIgnoreCase(str)) whereclause += " AND clearing_zone_code='99'"; } String fetchPrimary = "select * from VW_OW_OACK " + whereclause; pstmt1 = conn.prepareStatement(fetchPrimary, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); // Globals.setLog("fetchPrimary : " + fetchPrimary); rs1 = pstmt1.executeQuery(); rs1.last(); int count = rs1.getRow(); rs1.beforeFirst(); if (count == 0) { return "No Data found to create Report!"; } else if (!(export_path).equalsIgnoreCase("")) { int i = 1; filename = "OutwardOACKReport_" + curDate + "_" + System.currentTimeMillis() + ".xlsx"; SXSSFWorkbook wb = new SXSSFWorkbook(-1); //Manual flushing of rows Sheet sheet = wb.createSheet("Primary_Data"); Row rowhead = sheet.createRow((short) 0); rowhead.createCell(0).setCellValue("Sr.No."); rowhead.createCell(1).setCellValue("Date"); rowhead.createCell(2).setCellValue("BOFD"); rowhead.createCell(3).setCellValue("Clearing Type"); rowhead.createCell(4).setCellValue("Identifier"); rowhead.createCell(5).setCellValue("Transaction Class"); rowhead.createCell(6).setCellValue("Scanning Date"); rowhead.createCell(7).setCellValue("Scanning Time"); rowhead.createCell(8).setCellValue("Account Number"); rowhead.createCell(9).setCellValue("Account Name"); rowhead.createCell(10).setCellValue("Cheque Number"); rowhead.createCell(11).setCellValue("Amount"); rowhead.createCell(12).setCellValue("Sort Code"); rowhead.createCell(13).setCellValue("SAN No"); rowhead.createCell(14).setCellValue("TC"); rowhead.createCell(15).setCellValue("Endorsement number"); rowhead.createCell(16).setCellValue("P2F Flag"); rowhead.createCell(17).setCellValue("UDK"); rowhead.createCell(18).setCellValue("Business Segment"); rowhead.createCell(19).setCellValue("Profit Center"); rowhead.createCell(20).setCellValue("MicrRepairFlags"); rowhead.createCell(21).setCellValue("Account Type"); rowhead.createCell(22).setCellValue("Selected SOF"); CellStyle style = wb.createCellStyle(); DataFormat format = wb.createDataFormat(); style.setDataFormat(format.getFormat("0.00")); while (rs1.next()) { //changed on 10102020 row = sheet.createRow((int) i); row.createCell(0).setCellValue(i); row.createCell(1).setCellValue(new SimpleDateFormat("dd-MMM-yyyy").format(rs1.getDate("transaction_date"))); row.createCell(2).setCellValue(rs1.getString("bofd")); row.createCell(3).setCellValue(rs1.getString("clearing_zone_code")); row.createCell(4).setCellValue(rs1.getString("cbs_identifier")); row.createCell(5).setCellValue(rs1.getString("flow_type")); //row.createCell(6).setCellValue(new SimpleDateFormat("dd-MMM-yyyy").format(rs1.getDate("scanning_date"))); row.createCell(6).setCellValue((rs1.getString("scanning_date"))); row.createCell(7).setCellValue(rs1.getString("scanning_time")); row.createCell(8).setCellValue(rs1.getString("accountno")); row.createCell(9).setCellValue(rs1.getString("accountname")); row.createCell(10).setCellValue(rs1.getString("cheque_no")); //row.createCell(11).setCellValue(Double.parseDouble(rs1.getString("amount"))); Cell cell = row.createCell(11); cell.setCellValue(Double.parseDouble(rs1.getString("amount"))); cell.setCellStyle(style); row.createCell(12).setCellValue(rs1.getString("sortcode")); row.createCell(13).setCellValue(rs1.getString("san_no")); row.createCell(14).setCellValue(rs1.getString("tc")); row.createCell(15).setCellValue(rs1.getString("item_seq_number")); row.createCell(16).setCellValue(rs1.getString("p2f_flag")); row.createCell(17).setCellValue(rs1.getString("udk")); row.createCell(18).setCellValue(rs1.getString("business_segment")); row.createCell(19).setCellValue(rs1.getString("profit_center")); row.createCell(20).setCellValue(rs1.getString("micrrepairflags")); row.createCell(21).setCellValue(rs1.getString("NRE_Flag")); row.createCell(22).setCellValue(rs1.getString("SOFSELECTED")); i++; if(i % 1000 == 0) { ((SXSSFSheet)sheet).flushRows(); } } rs1.close(); rs1 = null; FileOutputStream fileOut = new FileOutputStream(export_path + filename); wb.write(fileOut); fileOut.close(); return "OK"; } else { return "Report Path not found"; } } catch (Exception e) { // Globals.setLog(e); return "Error " + e; } finally { // try { if (rs1 != null) { rs1.close(); rs1 = null; } if (pstmt1 != null) { pstmt1.close(); pstmt1 = null; } if (conn != null) { conn.close(); conn = null; } } catch (Exception fe) { Globals.setLog(fe); } } } }