How to get Bootstrap table data from the visible columns?

0

I have a table that has the extension resize disables some columns and I use the method $table.bootstrapTable('getData') I want to get a JSon with the remaining columns but the method brings all the columns. as it would be to bring only the visible columns. Then pass it to Google Chart. table bootstrap: link

    <table id="table"
       data-toggle="table"
       data-url="/Admin/ListSelect"
       data-show-export="true"
       data-pagination="true"
       data-resizable="true"
       data-click-to-select="true"
       data-toolbar="#toolbar"
       data-height="480"
       data-show-columns="true"
       data-search="true"
       data-flat="true"
       data-show-multi-sort="true"
       data-sort-priority='[{"sortName": "Nombre","sortOrder":"desc"},{"sortName":"Focus","sortOrder":"desc"}]'
       data-filter-control="true"
       data-filter-show-clear="true">
    <thead>
        <tr>
            @foreach (var aa in new AuxAudit().GetType().GetProperties())
            {
                <th data-field= @aa.Name data-sortable="true"> @aa.Name</th>
            }
        </tr>
    </thead>
</table>
<button id="button" class="btn btn-default">getData</button>
<div id="chart_div"></div>
<script type="text/javascript">
function LoadChart() {
    google.charts.load('current', { 'packages': ['corechart'] });
    google.charts.setOnLoadCallback(drawChart);
}


function drawChart() {

    var jsonData = JSON.stringify($('#table').bootstrapTable('getData'));
    var data = new google.visualization.DataTable(jsonData);


    var options = {'title':'Auditoria',
                   'width':400,
                   'height':300};

    var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
    chart.draw(data, options);
  }

    
asked by Luis Alberto Acosta 18.04.2018 в 17:54
source

1 answer

0

From the official documentation

getData:

  

Returns the data loaded in the table at the time this method is called. Setting the useCurrentPage to true will return the data displayed on the current page.

link

    
answered by 25.04.2018 в 18:28