封装datatables

(看主要JS代码部分)<!--Tab  -->
<h3 style="text-align: center">
    <strong>{:L('no_check_table')}</strong>
</h3>
<div class="tabbable">    <!--列表 begin-->    
    <table id="datatable1" class="table table-striped table-bordered table-hover ">        
        <thead>        
            <tr>            
                <th width="7%">
                    {:L('dispatch_batchid')}
                </th>            
                <th width="7%">
                    {:L('phoneNo')}
                </th>            
                <th width="7%">
                    {:L('realname')}
                </th>            
                <th width="7%">
                    {:L('dispatchmoney')}
                </th>            
                <th width="7%">
                    {:L('dispatch_title')}
                </th>            
                <th width="7%">
                    {:L('dispatch_content')}
                </th>            
                <th width="7%">
                    {:L('isdispatch')}
                </th>            
                <th width="7%">
                    {:L('dispatchtime')}
                </th>            
                <th width="7%">
                    {:L('auditstatus')}
                </th>            
                <th width="7%">
                    {:L('audituser')}
                </th>            
                <th width="7%">
                    {:L('audittime')}
                </th>            
                <th width="10%">
                    {:L('remark')}
                </th>        
            </tr>        
        </thead>        
        <tbody id="tdbody1">        
        </tbody>    
    </table>    
    <div id="page1">
    </div>    <!--列表 end-->
</div><!--删除、审核-->
<div class="col-xs-12 position-relative" style="margin-bottom: 10px;margin-top: 25px;text-align: center;">    <!--批量删除批号-->
        {:buildSelectList3($dispatch_batchid_list, 'batchid_list', '', 'input-sm',    array('value'=&gt;'',text=&gt;'--'.L('select_dispatch_batchid_list').'--'),$disabled=false)}    <input id="audit" type="button" class="btn btn-success fa" value="{:L('audit')}" />    <input id="delete" type="button" class="btn btn-danger fa" value="{:L('delete')}" />
</div><!-- bootstrap弹出模态框 -->
<div class="modal fade" tabindex="-1" role="dialog" id="auditDialog">    
    <div class="modal-dialog">        
        <div class="modal-content">            
            <div class="modal-header">                
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">×</span>
                </button>                
                <h4 class="modal-title">
                    {:L('audit')}
                </h4>            
            </div>            
            <div class="modal-body">                
                <input type="hidden" name="audit_dispatch_batchid" />                
                <div class="form-group">                    
                    <label for="reviewed" class="control-label">{:L('audit')}:</label>                    <select id="reviewed" class="form-control" name="reviewed">                        <option value="">{:L('pleaseChoose')}</option>                        <option value="1">{:L('pass')}</option>                        <option value="-1">{:L('not_pass')}</option>                    </select>                
                </div>                
                <div class="form-group" id="reason" style="display: none">                    
                    <label for="message-text" class="control-label">{:L('please_nopass_reason')}:</label>                    <textarea class="form-control" id="message-text" name="message-text"></textarea>                
            </div>            
        </div>            
        <div class="modal-footer">                
            <button type="button" class="btn btn-default" data-dismiss="modal">
                {:L('close')}
            </button>                
            <button type="button" class="btn btn-primary">
                {:L('submit')}
            </button>            
        </div>        
    </div><!-- /.modal-content -->    
</div><!-- /.modal-dialog -->
</div><!-- /.modal --><!--Tab  -->
<h3 style="text-align: center">
<strong>{:L('yes_check_table')}</strong>
</h3>
<div class="tabbable">    <!--列表 begin-->    
<table id="datatable2" class="table table-striped table-bordered table-hover ">        
    <thead>        
        <tr>            
            <th width="7%">
                {:L('dispatch_batchid')}
            </th>            
            <th width="7%">
                {:L('phoneNo')}
            </th>            
            <th width="7%">
                {:L('realname')}
            </th>            
            <th width="7%">
                {:L('dispatchmoney')}
            </th>            
            <th width="7%">
                {:L('dispatch_title')}
            </th>            
            <th width="7%">
                {:L('dispatch_content')}
            </th>            
            <th width="7%">
                {:L('isdispatch')}
            </th>            
            <th width="7%">
                {:L('dispatchtime')}
            </th>            
            <th width="7%">
                {:L('auditstatus')}
            </th>            
            <th width="7%">
                {:L('audituser')}
            </th>            
            <th width="7%">
                {:L('audittime')}
            </th>            
            <th width="10%">
                {:L('remark')}
            </th>        
        </tr>        
    </thead>        
    <tbody id="tdbody2">        
    </tbody>    
</table>    
<div id="page2">
</div>    <!--列表 end-->
</div>
使用方法: 支持JAVA和PHP两种后台。 PHP:直接将WebRoot下的文件放到php服务器上直接运行即可,记得启用sqlite3。 JAVA:修改user-manage.js,将访问后台的url由"datasource.php"改为"datasource.jsp",然后将WebRoot下的文件放到tomcat下直接运行。也可使用Eclipse直接导入此项目文件。 简要说明: 使用DataTable默认的ajax交互功能,对传给后台和从后台获取的数据都有命名格式要求,这样一来耦合度较高,不利于后期扩展,不能直接适用于需要跟多种不同前端或其他业务交互的项目。本例子主要展示了自行封装请求参数和返回数据的用法,对后台的交互没有任何格式和命名限制。 基于Bootstrap 2.3.2,相关的其他插件包括图标控件FontAwesome、等待提示控件Spinjs(修改版)、弹窗控件lhgdialog(修改版) 主要展现: 封装请求参数(查询、排序、分页,不再需要datadataFilter和dataSrc) 封装返回数据 自定义查询参数 服务器分页 自行控制和自定义遮罩效果 生成自定义效果的单元格(在线离线) 生成复选框单元格 响应复选框选择事件 生成操作按钮单元格 响应操作栏按钮点击事件 响应行点击事件 渲染回调事件(默认选中第一行) 分页栏增加跳页功能(直接修改了dataTables.bootstrap.js和dataTables.bootstrap.css) CSS实现单元格超长文字省略号显示 CSS实现单元格连续纯字母数字强制换行显示
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值