jquery datatable求助,我在百度上边看到你使用了jquery datatable的提问,你能不能给我一个你用过的例子
1个回答
展开全部
jsp代码
<divclass="row-fluid">
<divclass="table-header">资源列表</div>
<tableid="sample-table-2"
class="table table-striped table-borderedtable-hover">
<thead>
<tr>
<thclass="center">
<label>
<inputtype="checkbox"/>
<spanclass="lbl"></span>
</label>
</th>
<th>资源编号</th>
<th>资源类型</th>
<th>所属部门</th>
<th>所属分组</th>
<thclass="hidden-phone"><i
class="icon-timebigger-110 hidden-phone"></i>开卡时间</th>
<th>使用者</th>
<thclass="hidden-480">资源状态</th>
<th>操作</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
2、 js代码
oTable =$('#sample-table-2').dataTable({
"bProcessing": true, //显示是否加载
"bDestroy":true,
"sAjaxSource":"/extracommres/resource/getResourcelist",
"bServerSide":true,//打开服务器模式,这个是最重要的</font>
"bLengthChange":true, //关闭每页显示多少条数据
"oLanguage": {
"sProcessing": "处理中...",
"sLengthMenu": "显示_MENU_ 项结果",
"sZeroRecords": "没有匹配结果",
"sInfo": "显示第_START_ 至_END_ 项结果,共_TOTAL_ 项",
"sInfoEmpty": "显示第0 至0 项结果,共0 项",
"sInfoFiltered": "(由_MAX_项结果过滤)",
"sSearch": "搜索:",
},//国际化
"aLengthMenu": [[1, 2, 3, -1], [1, 2, 3, "All"]],
"iDisplayLength": 1,
"aoColumns": [
{
'mData':'id',
'bSortable': false,
'aTargets':[2],
'aDataSort': [ 0],
'mRender':function(data,type,row){
return"<divalign='center'><label><input name='id' type='checkbox'value='"+ data+"' /><span></span></label></div>";
}
},
{
'mData':'serialNumber',
'aTargets':[2],
'aDataSort': [ 1],
'mRender':function(data,type,row){
return"<a href='${ctx}/resource/getface/"+data+"'>"+data+"</a>";
}
},
{
'mData':'type',
'aTargets':[2],
'aDataSort': [ 1]
},
{
'mData':'dept',
'aTargets':[2],
'aDataSort': [ 1]
},
{
'mData':'group',
'aTargets':[2],
'aDataSort': [ 1]
},
{
'mData':'initTime',
'aTargets':[2],
'aDataSort': [ 1]
},
{
'mData':'user',
'aTargets':[2],
'aDataSort': [ 1]
},
{
'mData':'statue',
'aTargets':[2],
'aDataSort': [ 1]
},
{
'mData':'id',
'bSortable': false,
'aTargets':[2],
'aDataSort': [ 1],
'mRender':function(data,type,row){
return"<div class='hidden-phone visible-desktopaction-buttons'>"+
"<a href=''><iclass='icon-zoom-in bigger-130'></i></a> "+
"<aclass='green' href=''><i></i></a>"+
"<aclass='red' href=''> <i></i></a>"+
"</div>";
}
}
] });
我这儿不能上传附件,留下你的邮件,给你发我整理的资料;
<divclass="row-fluid">
<divclass="table-header">资源列表</div>
<tableid="sample-table-2"
class="table table-striped table-borderedtable-hover">
<thead>
<tr>
<thclass="center">
<label>
<inputtype="checkbox"/>
<spanclass="lbl"></span>
</label>
</th>
<th>资源编号</th>
<th>资源类型</th>
<th>所属部门</th>
<th>所属分组</th>
<thclass="hidden-phone"><i
class="icon-timebigger-110 hidden-phone"></i>开卡时间</th>
<th>使用者</th>
<thclass="hidden-480">资源状态</th>
<th>操作</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
2、 js代码
oTable =$('#sample-table-2').dataTable({
"bProcessing": true, //显示是否加载
"bDestroy":true,
"sAjaxSource":"/extracommres/resource/getResourcelist",
"bServerSide":true,//打开服务器模式,这个是最重要的</font>
"bLengthChange":true, //关闭每页显示多少条数据
"oLanguage": {
"sProcessing": "处理中...",
"sLengthMenu": "显示_MENU_ 项结果",
"sZeroRecords": "没有匹配结果",
"sInfo": "显示第_START_ 至_END_ 项结果,共_TOTAL_ 项",
"sInfoEmpty": "显示第0 至0 项结果,共0 项",
"sInfoFiltered": "(由_MAX_项结果过滤)",
"sSearch": "搜索:",
},//国际化
"aLengthMenu": [[1, 2, 3, -1], [1, 2, 3, "All"]],
"iDisplayLength": 1,
"aoColumns": [
{
'mData':'id',
'bSortable': false,
'aTargets':[2],
'aDataSort': [ 0],
'mRender':function(data,type,row){
return"<divalign='center'><label><input name='id' type='checkbox'value='"+ data+"' /><span></span></label></div>";
}
},
{
'mData':'serialNumber',
'aTargets':[2],
'aDataSort': [ 1],
'mRender':function(data,type,row){
return"<a href='${ctx}/resource/getface/"+data+"'>"+data+"</a>";
}
},
{
'mData':'type',
'aTargets':[2],
'aDataSort': [ 1]
},
{
'mData':'dept',
'aTargets':[2],
'aDataSort': [ 1]
},
{
'mData':'group',
'aTargets':[2],
'aDataSort': [ 1]
},
{
'mData':'initTime',
'aTargets':[2],
'aDataSort': [ 1]
},
{
'mData':'user',
'aTargets':[2],
'aDataSort': [ 1]
},
{
'mData':'statue',
'aTargets':[2],
'aDataSort': [ 1]
},
{
'mData':'id',
'bSortable': false,
'aTargets':[2],
'aDataSort': [ 1],
'mRender':function(data,type,row){
return"<div class='hidden-phone visible-desktopaction-buttons'>"+
"<a href=''><iclass='icon-zoom-in bigger-130'></i></a> "+
"<aclass='green' href=''><i></i></a>"+
"<aclass='red' href=''> <i></i></a>"+
"</div>";
}
}
] });
我这儿不能上传附件,留下你的邮件,给你发我整理的资料;
来自:求助得到的回答
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询