Ejemplo n.º 1
0
 public void dataBindSpecifiedColumns(DataListAction dla) {
   ZCCustomTableSchema table = new ZCCustomTableSchema();
   table.setSiteID($V("SiteID"));
   table.setCode($V("TableCode"));
   ZCCustomTableSet set = table.query();
   if ((set == null) || (set.size() < 1)) {
     LogUtil.warn("ID为" + table.getSiteID() + "的站点下没有代码为" + table.getCode() + "的表!");
     return;
   }
   table = set.get(0);
   if (!"Y".equals(table.getAllowView())) {
     LogUtil.warn("ID为" + table.getSiteID() + "的站点下代码为" + table.getCode() + "的表不允许前台查看!");
     return;
   }
   DataTable dt = CustomTableUtil.getData(set.get(0), null, dla.getPageSize(), dla.getPageIndex());
   dla.setTotal(CustomTableUtil.getTotal(table, "where 1=1"));
   dla.bindData(dt);
 }
Ejemplo n.º 2
0
 public void dataBindAllColumns(DataListAction dla) {
   ZCCustomTableSchema table = new ZCCustomTableSchema();
   table.setSiteID($V("SiteID"));
   table.setCode($V("TableCode"));
   ZCCustomTableSet set = table.query();
   if ((set == null) || (set.size() < 1)) {
     LogUtil.warn("ID为" + table.getSiteID() + "的站点下没有代码为" + table.getCode() + "的表!");
     return;
   }
   table = set.get(0);
   if (!"Y".equals(table.getAllowView())) {
     LogUtil.warn("ID为" + table.getSiteID() + "的站点下代码为" + table.getCode() + "的表不允许前台查看!");
     return;
   }
   DataTable dt = CustomTableUtil.getData(set.get(0), null, dla.getPageSize(), dla.getPageIndex());
   ZCCustomTableColumnSet cset =
       new ZCCustomTableColumnSchema().query(new QueryBuilder("where TableID=?", table.getID()));
   HtmlTR tr = new HtmlTR();
   ArrayList list = new ArrayList();
   for (int i = 0; i < cset.size(); ++i) {
     HtmlTD td = new HtmlTD();
     td.setInnerHTML(cset.get(i).getName());
     tr.addTD(td);
   }
   list.add(tr);
   for (int i = 0; i < dt.getRowCount(); ++i) {
     tr = new HtmlTR();
     for (int j = 0; j < dt.getColCount(); ++j) {
       HtmlTD td = new HtmlTD();
       td.setInnerHTML(dt.getString(i, j));
       tr.addTD(td);
     }
     list.add(tr);
   }
   dt = new DataTable();
   dt.insertColumn("RowHTML");
   for (int i = 0; i < list.size(); ++i) {
     tr = (HtmlTR) list.get(i);
     dt.insertRow(new Object[] {tr.getOuterHtml()});
   }
   dla.setTotal(CustomTableUtil.getTotal(table, "where 1=1"));
   dla.bindData(dt);
 }