問題:遍歷以下數據,取得每一列的值,並從新進行排序。排序
2012-2013春季,50,24,0,240,250,1690,住宅,146, 100.0;rem
2013-2014秋季,50,20,0,0,250,1250,低保戶,145, 100.0;it
分析:該數據分割兩次。「;」首分割,「,」次分割。io
實現:
<#list orderpaydetail.attributeItems['qfndxx']?split(";") as qfndxx> <!-- ;分割-->
<tr>
<td style="text-align:center">
<#list qfndxx?split(",") as attrList> <!-- ,分割-->
<#if attrList_index == 0> <!-- 第一列 ,attrList_index表示下標值-->
${attrList}
</#if>
</#list>
</td>
<td style="text-align:center">
<#list qfndxx?split(",") as attrList>
<#if attrList_index == 7> <!-- 第八列 -->
${attrList}
</#if>
</#list>
</td>
<td style="text-align:center">
<#list qfndxx?split(",") as attrList>
<#if attrList_index == 8><!-- 第九列 -->
${attrList}
</#if>
</#list>
</td>
<#list qfndxx?split(",") as attrList>
<#if (attrList_index >= 1 && attrList_index < 7)><!-- 第二列到第七列 -->
<td style="text-align:center">${attrList}</td>
</#if>
</#list>
<td style="text-align:center">
<#list qfndxx?split(",") as attrList>
<#if attrList_index == 9> <!-- 第十列 -->
${attrList}
</#if>
</#list>
</td>
</tr>
</#list>
Ps: 如上遍歷會產生空值行,什麼緣由我沒有驗證。 個人解決方案是: 將該行刪除。 ast
$(document).ready(function() {
$("#last").prev().remove();
});
function