locked
export with bootstrap RRS feed

  • Question

  • User-1105778986 posted

    Hello , i need a help please , i have a datatable bootstrap with multi records ( multi pagination ) , when i export with "btechco_excelexport " , the file exel contains just the records in the current page and not the all records , how to export all records ? 

    Friday, October 20, 2017 9:09 AM

Answers

  • User-707554951 posted

    Hi amerta,

    From your description, you want to expoet all data while with multi pages.

    You could refer to the code as below:

    <div id="toolbar">
      <select class="form-control">
        <option value="">Export Basic</option>
        <option value="all">Export All</option>
        <option value="selected">Export Selected</option>
      </select>
    </div>
    <table id="table"
           data-toggle="table"
           data-toolbar="#toolbar"
           data-show-export="true"
           data-pagination="true"
           data-maintain-selected="true"
           data-page-size="5"
           data-page-list="[5, 25, 50, 100, ALL]"
           data-url="/gh/get/response.json/wenzhixin/bootstrap-table/tree/master/docs/data/data2/"
           data-export-options='{
             "fileName": "test", 
             "ignoreColumn": ["state"]
           }'
           >
        <thead>
        <tr>
            <th data-field="state" data-checkbox="true"></th>
            <th data-field="id">ID</th>
            <th data-field="name">Name</th>
            <th data-field="price">Price</th>
        </tr>
        </thead>
    </table>
    $(function () {
                    var $table = $('#table');
                    $('#toolbar').find('select').change(function () {
        $table.bootstrapTable('refreshOptions', {
          exportDataType: $(this).val()
        });
      });
    });

    For more detail, you could refer to the following link:

    http://jsfiddle.net/ggywebtech/apseb49f/2/

    http://issues.wenzhixin.net.cn/bootstrap-table/#extensions/export.html

    Best regards,

    Cathy

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 23, 2017 5:48 AM

All replies

  • User-707554951 posted

    Hi amerta,

    From your description, you want to expoet all data while with multi pages.

    You could refer to the code as below:

    <div id="toolbar">
      <select class="form-control">
        <option value="">Export Basic</option>
        <option value="all">Export All</option>
        <option value="selected">Export Selected</option>
      </select>
    </div>
    <table id="table"
           data-toggle="table"
           data-toolbar="#toolbar"
           data-show-export="true"
           data-pagination="true"
           data-maintain-selected="true"
           data-page-size="5"
           data-page-list="[5, 25, 50, 100, ALL]"
           data-url="/gh/get/response.json/wenzhixin/bootstrap-table/tree/master/docs/data/data2/"
           data-export-options='{
             "fileName": "test", 
             "ignoreColumn": ["state"]
           }'
           >
        <thead>
        <tr>
            <th data-field="state" data-checkbox="true"></th>
            <th data-field="id">ID</th>
            <th data-field="name">Name</th>
            <th data-field="price">Price</th>
        </tr>
        </thead>
    </table>
    $(function () {
                    var $table = $('#table');
                    $('#toolbar').find('select').change(function () {
        $table.bootstrapTable('refreshOptions', {
          exportDataType: $(this).val()
        });
      });
    });

    For more detail, you could refer to the following link:

    http://jsfiddle.net/ggywebtech/apseb49f/2/

    http://issues.wenzhixin.net.cn/bootstrap-table/#extensions/export.html

    Best regards,

    Cathy

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 23, 2017 5:48 AM
  • User-1105778986 posted

    thank's a lot  Cathy Zou 

    Monday, October 23, 2017 10:31 AM