• datable


         $("#table_d").append("<table id='dmglTable' class='table table-striped table-hover table-bordered dataTable no-footer dtr-inline'></table>");
            var zwkmzdTable = $("#dmglTable").dataTable({
                serverSide: true,
                responsive: true,
                processing:true,
                autoWidth: true,//自动计算列宽
                deferRender: true,//设置延迟渲染,提高效率用
                draw:false,
                order: [ 1, 'asc' ],
                ajax: {
                    url: "dmgl/getDmglInfoData",
                    type: "POST",
                    data : function(d) {  
                        var sentJson = GET_SENT_JSON(d);
                        
                        //追加数据 sentJson.name=22
                        return sentJson;
                    },
                    error: function (e) {
                        ALERT_ERROR(zwkmzdTable,e);
                    },
                },
                lengthMenu: PAGELENGTH,
                "language": LANGUAGESETTING,
                oLanguage: {//多语言配置
                    "sSearchPlaceholder": "科目编号、名称",//搜索框内占位符
                    "sSearch": "检索:",//搜索框前的字体
                    "sProcessing": "正在加载中......",
                    "sLengthMenu": "每页显示 _MENU_ 条记录",
                    "sZeroRecords": "对不起,查询不到相关数据!",
                    "sEmptyTable": "表中无数据存在!",
                    "sInfo": "当前显示 _START_ 到 _END_ 条,共 _TOTAL_ 条记录",
                    "sInfoEmpty": "没有记录可以显示",
                    "sInfoFiltered": "数据表中共为 _MAX_ 条记录",
                    "oPaginate": {
                        "sFirst": "首页",
                        "sPrevious": "上一页",
                        "sNext": "下一页",
                        "sLast": "末页"
                    }
                },
                columnDefs : [
                    { "targets": 0 ,"name":"kmbh","title": "","width": "2%"},
                    { "targets": 1 ,"name":"kmbh","title": "科目编号","width": "10%"},
                    { "targets": 2 ,"name":"kmmc","title": "科目名称" ,"width": "15%"},
                    { "targets": 3 ,"name":"kmsx","title": "科目属性" ,"width": "5%"}
                ],
                columns: [
                    {
                        "className":      'details-control',
                        "orderable":      false,
                        "data":           null,
                        "defaultContent": ''
                    },
                    { data: 'kmbh'},
                    { data: 'kmmc'},
                    { 'data': function(value){
                          var kmsx = value.kmsx;
                          if (kmsx == 1) {
                              return '资产';
                          } else if(kmsx == 2){
                              return '负债';
                          } else if(kmsx == 3){
                              return '净资产';
                          } else if(kmsx == 4){
                              return '收入';
                          } else if(kmsx == 5){
                              return '支出';
                          } else if(kmsx == 6){
                              return '预算';
                          }else{
                              return ' ';
                          }
                      }
             },
    ] }); $('#dmglTable tbody tr').die().live('click', function() { var tr = $(this).closest('tr') var row = $('#dmglTable').DataTable().row(this) if ( row.child.isShown() ) { row.child.hide(); tr.removeClass('shown'); // tr.children("td.details-control").children("i").attr('class','fa fa-plus-square'); } else { row.child( format(row.data()) ).show(); tr.next().children("td").css({"padding": "0px"}); tr.addClass('shown'); // tr.children("td.details-control").children("i").attr('class','fa fa-minus-square'); } }); //鼠标移动添加背景颜色 mouseEvent("dmglTable"); }; function format (d) { var wbhs; var bmhs; var xmhs; return '<table class="table table-striped table-hover table-bordered no-footer1 dtr-inline" style="margin-bottom: 0px">'+ '</tr>'+ '<td style="border: 0px solid #ddd;text-align:right; 10%">外币核算:</td>'+ '<td style="border: 0px solid #ddd;text-align:left; 8%">'+wbhs+'</td>'+ '<td style="border: 0px solid #ddd;text-align:right; 8%">外币编号:</td>'+ '<td style="border: 0px solid #ddd;text-align:left; 8%">'+wbbh+'</td>'+ '<td style="border: 0px solid #ddd;text-align:right; 8%">部门核算:</td>'+ '<td style="border: 0px solid #ddd;text-align:left; 8%">'+bmhs+'</td>'+ '</tr>'+ '</table>'; }
  • 相关阅读:
    高级指令(三)
    高级指令(二)
    高级指令(一)
    高级指令(四)
    基础指令(二)
    02使用Maven构建Java项目
    03初识Maven核心概念(上)
    01Maven概述与安装
    关于sizeof与#pragma pack 以及网络上关于字节对齐的一点感想
    学习之"setjmp和longjmp函数"
  • 原文地址:https://www.cnblogs.com/sunBinary/p/9970893.html
Copyright © 2020-2023  润新知