数据表在列中显示多个数据

时间:2018-08-22 12:29:02

标签: javascript datatable datatables

enter image description here

我正在使用数据表来显示从mysql到前端的数据,但是我被困在指定列中显示多个指定

用于初始化数据表的代码

script(type='text/javascript').
      $(document).ready(function() {
      $('#mytab').DataTable({
       dom: 'Bfrtip',
       buttons: [
        'copy', 'csv', 'excel', 'pdf','print'
        ],

  });
      });

用于从数据库检索数据

 tbody
        if user
        each user, i in users
          tr.profiledata
            th= user.getDataValue('name') 
            th= user.getDataValue('stack_holder')
            th= user.getDataValue('client_name')
            th.reference #{user.getDataValue('reference')}
            th= user.getDataValue('document_type')
            th= user.getDataValue('service_type')
            th= user.getDataValue('year')
            th
              if((a = user.getDataValue('PO_start_date'))!=null)
                  |  #{a.getDate() + '-' + (a.getMonth()+1) + '-' + a.getFullYear()}
            th
              if((a = user.getDataValue('PO_end_date'))!=null)
                |  #{a.getDate() + '-' + (a.getMonth()+1) + '-' + a.getFullYear()}
            th
              if((a = user.getDataValue('reminder_date'))!=null)
                |  #{a.getDate() + '-' + (a.getMonth()+1) + '-' + a.getFullYear()} 

            if(user.getDataValue('transaction_tbls').length > 0)
              for tr in user.getDataValue('transaction_tbls')
                th= (tr['dataValues'])['designation']
                th= (tr['dataValues'])['quantity']
                th= (tr['dataValues'])['rate']
            else
              th
              th
              th
            th= user.getDataValue('signature_status')
            th= (a = user.getDataValue('createdAt')).getDate() + '-' + (a.getMonth()+1) + '-' + a.getFullYear()
            th= user.getDataValue('client') 
            th= user.getDataValue('contact') 
            th= user.getDataValue('contactperson') 
            th= user.getDataValue('contactnumber') 
            th= user.getDataValue('emailid') 
            th= user.getDataValue('period_of_contract')
            th= user.getDataValue(' payment_term')
            th= user.getDataValue('financial_year')    

响应服务器,我得到了表的对象,例如transaction_tbl:[]

0 个答案:

没有答案