首页 > 解决方案 > jquery 数据表 - csv 导出列显示空值

问题描述

我必须将包含 33 列的数据库表中的一些值导出到 CSV 文件中。我使用了数据表。

我必须将(33 列)的所有值显示为一列(必需格式)。我将所有值连接成一个字符串并将其显示到一个数据表列。我必须保留其他列,否则数据表功能不起作用。但在导出 CSV 文件后,空白列显示为null. 我想null用空白替换。我应该怎么办?

我的 Java 结束代码

       String sql = "select outletcode,remfname,remitt_id_details,dob,traninfomal.nationality as nationality,address1,remitt_tel,traninfomal.occupation as occupation,"
                        + "rememployername,bofullname,remiter_type,boidnumber,bodob,bonationality,boaddress,benename,BENE_IDENTIFICATION_NO,tranno,traninfomal.entereddatetime,"
                        + "transtatus,REMAMOUNTDEST,RATEVALUE,REMAMOUNTSOURCE,commission,traninfomal.purpose as purpose,sourceincome,beneaccountno,remrel,TRANTOTALPAY  from  traninfomal, agrani_membersmal \n" + 
                        "  where  remid = member_id and  traninfomal.entereddatetime  between '"+userdate+"' and '"+userdate1+"'  and transtatus  in ('2' ,'3')  ";
           trandataind = jdbcTemplate.query(sql,new BeanPropertyRowMapper<XXX>(XXX.class));   

请找图片

<div class="container" style="padding: 10px 10px;">
  <h1>Export Data into CSV,EXCEL,PDF & PRINT</h1>
  <table id="listing" class="display" cellspacing="0" width="100%">
    <thead>
      <tr>
        <th>1</th>
        <th>2</th>
        <th>3Customer Name</th>
        <th>4Customer ID</th>
        <th>5Date of Birth</th>
        <th>6Nationality</th>
        <th>7Address</th>
        <th>8Contact Number</th>
        <th>9Occupation</th>
        <th>10Name of employer</th>
        <th>11BO Name</th>
        <th>12Type of Customer</th>
        <th>13BO ID</th>
        <th>14BO Date of Birth</th>
        <th>15BO Nationality</th>
        <th>16BO Address</th>
        <th>17Receiver name</th>
        <th>18Receiver id</th>
        <th>19Receipt no</th>
        <th>20Transaction Date & Time</th>
        <th>21tran status</th>
        <th>22E channel</th>
        <th>23 IP </th>
        <th>24 BDT Net Amount</th>
        <th>25 Foreign Currency Amount</th>
        <th>26 Rate </th>
        <th>27remamountsrc</th>
        <th>28 Charges</th>
        <th>29 Purpose</th>
        <th>30 source of fund</th>
        <th>31 destination country</th>
        <th>32 bank account</th>
        <th>33 bank account</th>
      </tr>
    </thead>
  </table>
var metadata;

metadata = "16328|" + outletcode + "|" + remfname + "|" + remitt_id_details + "|" + dob + "|" + nationality + "|" + remaddress1 + "|" + remitt_tel + "|" + occupation + "|" + rememployername + "|" + bofname + "|" + remiter_type + "|" + boid + "|" + bodob + "|" + bonationality + "|" + boaddress + "|" + benename + "|" + BENE_IDENTIFICATION_NO + "|" + tranno + "|" + entereddatetime + "|" + transtatus + "|" + "" + "|" + "" + "|BDT|" + remamountdest + "|" + ratevalue + "|" + remamountsource + "|" + commission + "|" + purpose + "|" + sourceincome + "|BD|" + beneaccountno + "|" + remrel;

arrayReturn.push([metadata]);
inittable(arrayReturn);

标签: jquerydatatableexport-to-csv

解决方案


推荐阅读