⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 table.ftl

📁 JSP(Java Server Pages)是由Sun Microsystems公司倡导、许多公司参与一起建立的一种动态网页技术标准。 JSP技术是用JAVA语言作为脚本语言的
💻 FTL
字号:
<#macro table cols normalOperate=[] batchOperate=[] keepParams=[] params=["pageNo"] gotoPageAction="Com_list"
  keyId="id" batchId="ids" value=pagination isPagination=true rowIndex=true operateCol="操作选项"
  width="auto">
<script language="javascript">
  <#list normalOperate as operate>
    var ${operate["action"]} = {action:"<@s.url action='${operate["action"]}'/>"<#if operate['confirm']??>,msg:"${operate['confirm']}"</#if>};
  </#list>  
  function _gotoPage(pageNo) {
    try{ 
      //gotoPage(pageNo);
      var tableForm = document.getElementById('tableForm');
      tableForm.pageNo.value = pageNo;
      tableForm.action="<@s.url action='${gotoPageAction}' />";
      tableForm.onsubmit=null;
      tableForm.submit();
      document.getElementById("_pagination_selector").disabled = true;
    } catch(e) {
      alert('gotoPage(pageNo)方法出错或不存在');
    }
  }
  function _operate(op,id) {
    if(op.msg && !confirm(op.msg)) {
      return;
    }
    var tableForm = document.getElementById('tableForm');
    tableForm.onsubmit=null;
    tableForm.action=op.action;
    tableForm.${keyId}.value = id;
    tableForm.submit();
  }
  function _validateBatch() {
    var batchChecks = document.getElementsByName('${batchId}');
    var hasChecked = false;
    for(var i=0; i<batchChecks.length; i++) {
      if(batchChecks[i].checked) {
        hasChecked = true;
        break;
      }
    }
    if(!hasChecked) {alert('请选择要操作的数据!')};
    return hasChecked;
  }
</script>
<form id="tableForm" method="post" onsubmit="return _validateBatch();">
<#--<#include "table_inc_batchoperate.ftl" />-->
<table width="${width}" cellspacing="1" cellpadding="0" align="center" bgcolor="#d8d8d8" border="0" class="list-table" id="list_table">
<thead align="left" bgcolor="#ffffff">
<tr>
<#if batchOperate?size gt 0>
  <th width="20px"><input type="checkbox" name="allCheck" value="checkbox" onclick="checkAll('${batchId}', this.checked);" /></th>
</#if>
<#if rowIndex>
  <th width="20px">#</th>
</#if>
<#list cols as col>
  <th>${col["label"]}</th>
</#list>
<#if normalOperate?size != 0>
  <th>&nbsp;${operateCol}&nbsp;</th>
</#if>
</tr>
</thead>
<tbody bgcolor="#ffffff">
<#if isPagination>
  <#assign pageList=value.list>
<#else>
  <#assign pageList=value>
</#if>
<#list pageList as row>
  <tr onmouseover="Pn.Cms.lineOver(this);" onmouseout="Pn.Cms.lineOut(this);" onclick="Pn.Cms.lineSelect(this);">
  <#if batchOperate?size gt 0>
    <td><input type="checkbox" name="${batchId}" value="${row[keyId]}" /></td>
  </#if>
  <#if rowIndex>
    <td>${row_index+1}</td>
  </#if>
  <#list cols as col>
    <td<#if col['width']??> width="${col['width']}"</#if><#if col['title']??> title="${(col['title']?eval)!}"</#if>>
    <#if col['length']??><div style="width:${col['length']}px;overflow-x:hidden;word-break:keep-all;text-overflow:ellipsis;" title="${(col['name']?eval)!?html}"></#if>
    <#if (col['name']?eval)??><#if col['escape']!true>${(col['name']?eval)!?html}<#else>${(col['name']?eval)!}</#if><#else>${col['default']!}</#if>
    <#if col['length']??></div></#if>
    </td>
    <#--
    <td>${(col['name']?eval)}&nbsp;</td> 
    <td>${("row.${col['name']}"?eval)!?html}&nbsp;</td>  
    <td><@ognl value=row name=col["name"] />&nbsp;</td>
    -->
  </#list>
  <td>
  <#list normalOperate as operate>
  	<#local opDisabled = operate['displayExp']?? && !operate['displayExp']?eval />
    <@p.operateRight operate=operate['action']><a<#if opDisabled> disabled="disabled" style="background-color:#CCCCCC;"<#else> href="javascript:_operate(${operate['action']},'${row[keyId]}');"</#if>>${operate["name"]}</a></@p.operateRight>
  </#list><#t />
  </td>
  </tr>
</#list>
</tbody>
</table>
<#if pageList?size <= 0>
<div style="padding:10px 30px;font-weight:bold;text-align:center;color:red;border:1px solid #CCCCCC;border-top:0px;margin-bottom:5px;">没有相关数据!</div>
</#if>
<#include "table_inc_batchoperate.ftl" />
<input id="${keyId}" type="hidden" name="${keyId}"/>
<@s.hidden name="pageNo" />
<#list keepParams as keep>
<@s.hidden name="${keep}" />
</#list>
<#list Parameters?keys as pkey>
  <#if pkey!=keyId && pkey!=batchId && !keepParams?seq_contains(pkey) && pkey?starts_with('query')>
    <@s.hidden name="${pkey}" />
  </#if>
</#list>
<#if isPagination>
  <div id="pagination">
  共${value.totalCount}条记录 ${value.page}/${value.totalPage}页 
  <#if value.isFirstPage>首页 上一页
    <#else><a href="javascript:_gotoPage('1')">首页</a> <a href="javascript:_gotoPage('${value.page-1}')">上一页</a>
  </#if>
  第<select id="_pagination_selector" onChange='javascript:_gotoPage(this.value)'>
  <#list 1..value.totalPage as i>
    <option value="${i}" <#if value.page==i>selected="selected"</#if>>${i}</option>
  </#list>
  </select>页
  <#if value.isLastPage>下一页 尾页
  <#else><a href="javascript:_gotoPage('${value.page+1}')">下一页</a> <a href="javascript:_gotoPage('${value.totalPage}')">尾页</a>
  </#if>
  </div>
</#if>
</form>
</#macro>

<#--
<#macro ognl value name default="">
  <#list name?split(".") as s>
    <#if !(value[s])??>${default}<#return /></#if><#t />
    <#local value=value[s] />
  </#list>
  ${value}<#t />
</#macro>

<@s.iterator value="pagination.list" status="sta">
<tr>
  <td><input type="checkbox" name="${batchId}" value="<@s.property value='${keyId}' />" /></td>  
  <#if rowIndex>
  <td>${sta.count}</td>
  </#if>
  <#list cols as col>
  <td><@s.property value='${col[1]}' /></td>
  </#list>   
</tr>
</@s.iterator>

<#list params as param>
   <@s.param name="${param}" value="${param}" />
</#list>

<#list normalOperate as operate>
  <@s.url id="url" action='${operate["action"]}'>
    <@s.param name="${keyId}">${row[keyId]}</@s.param>
    <#list Parameters?keys as pkey>
      <@s.param name="${pkey}">${Parameters[pkey]}</@s.param>
    </#list>
  </@s.url>
  <a href="${url}" <#if (operate.confirm)??>onclick="return confirm('${operate.confirm}')"</#if>>${operate["name"]}</a>
</#list>

<#list params as param>
  <@s.hidden name="${param}" />
</#list>
-->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -