如何在JSP中,实现下面表中记录按列的升序、降序?
<tableclass="tabletable-stripedtable-borderedbootstrap-datatable"id="courierpackageIn...
<table class="table table-striped table-bordered bootstrap-datatable " id="courierpackageInfo">
<thead>
<tr role="row">
<th class="sorting_asc" role="columnheader" tabindex="0" style="width:40px;"
aria-controls="DataTables_Table_0" rowspan="1" colspan="1">序号</th>
<th class="sorting" role="columnheader" tabindex="0" style="width:120px;"
aria-controls="DataTables_Table_0" rowspan="1" colspan="1">快递信息</th>
<th class="sorting" role="columnheader" tabindex="0" style="width:90px;text-align:center;"
aria-controls="DataTables_Table_0" rowspan="1" colspan="1" >运单号</th>
<th class="sorting" role="columnheader" tabindex="0" style="width:160px;text-align:center;"
aria-controls="DataTables_Table_0" rowspan="1" colspan="1" >存入/取出时间</th>
<th class="sorting" role="columnheader" tabindex="0" style="width:80px;"
aria-controls="DataTables_Table_0" rowspan="1" colspan="1" >滞留时间</th>
<th class="sorting" role="columnheader" tabindex="0"
aria-controls="DataTables_Table_0" rowspan="1" colspan="1">操 作</th>
</tr>
</thead>
<tbody>
<s:if test="page.list==null||page.list.size()==0">
<tr><td colspan="9">=_= 没有查询到任何数据!</td></tr>
</s:if>
<s:iterator value="page.list" status="st">
<tr class="odd">
<td style="text-align:center;line-height:50px;"><s:property value="#st.index+1" /></td>
<td class="courierInfo" userId="<s:property value="user.userId"/>"></td>
<td style="text-align:center;line-height:50px;"><s:property value="parcelParcelNum" /></td>
<td >
<s:property value="parcelUserName" /><br/><br/>
<s:property value="parcelUserMobileNum" />
</td>
<td style="line-height:20px;">
存入:<s:date name="parcelStoreTime" format="yyyy-MM-dd HH:mm:ss" /><br/>
取出:<s:date name="parcelGetTime" format="yyyy-MM-dd HH:mm:ss" />
</td>
<td style="text-align:center;line-height:50px;"><s:property value="leftTime" /></td>
</td>
<td >
<a href="javascript:void(0);" parcelId="<s:property value="parcelId"/>"
class="packageDetails">包裹详情 </a><br/><br/>
<a href="javascript:void(0);" parcelId="<s:property value="parcelId"/>"
class="packageDispose">包裹处理 </a>
</td>
</tr>
</s:iterator>
</tbody>
</table> 展开
<thead>
<tr role="row">
<th class="sorting_asc" role="columnheader" tabindex="0" style="width:40px;"
aria-controls="DataTables_Table_0" rowspan="1" colspan="1">序号</th>
<th class="sorting" role="columnheader" tabindex="0" style="width:120px;"
aria-controls="DataTables_Table_0" rowspan="1" colspan="1">快递信息</th>
<th class="sorting" role="columnheader" tabindex="0" style="width:90px;text-align:center;"
aria-controls="DataTables_Table_0" rowspan="1" colspan="1" >运单号</th>
<th class="sorting" role="columnheader" tabindex="0" style="width:160px;text-align:center;"
aria-controls="DataTables_Table_0" rowspan="1" colspan="1" >存入/取出时间</th>
<th class="sorting" role="columnheader" tabindex="0" style="width:80px;"
aria-controls="DataTables_Table_0" rowspan="1" colspan="1" >滞留时间</th>
<th class="sorting" role="columnheader" tabindex="0"
aria-controls="DataTables_Table_0" rowspan="1" colspan="1">操 作</th>
</tr>
</thead>
<tbody>
<s:if test="page.list==null||page.list.size()==0">
<tr><td colspan="9">=_= 没有查询到任何数据!</td></tr>
</s:if>
<s:iterator value="page.list" status="st">
<tr class="odd">
<td style="text-align:center;line-height:50px;"><s:property value="#st.index+1" /></td>
<td class="courierInfo" userId="<s:property value="user.userId"/>"></td>
<td style="text-align:center;line-height:50px;"><s:property value="parcelParcelNum" /></td>
<td >
<s:property value="parcelUserName" /><br/><br/>
<s:property value="parcelUserMobileNum" />
</td>
<td style="line-height:20px;">
存入:<s:date name="parcelStoreTime" format="yyyy-MM-dd HH:mm:ss" /><br/>
取出:<s:date name="parcelGetTime" format="yyyy-MM-dd HH:mm:ss" />
</td>
<td style="text-align:center;line-height:50px;"><s:property value="leftTime" /></td>
</td>
<td >
<a href="javascript:void(0);" parcelId="<s:property value="parcelId"/>"
class="packageDetails">包裹详情 </a><br/><br/>
<a href="javascript:void(0);" parcelId="<s:property value="parcelId"/>"
class="packageDispose">包裹处理 </a>
</td>
</tr>
</s:iterator>
</tbody>
</table> 展开
展开全部
点击列名超链接时,用ajax在后台调用你的查询方法,并传入一个动态参数放到sql里面:order by XXX(参数列名) desc/asc。
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
前台 用js实现
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询