optional.
Method 1. Update Bootgrid to version 1.3 and install "visible data"
<th data-column-id="Id" data-visible="false">Id</th>
/ / ----------------------------------
method 2. (old version) use jquery to launch the hide / show column tool.
<table id="grid-keep-selection" class="table table-condensed table-hover table-striped"> <thead> <tr> <th data-column-id="id_col1" data-order="desc" data-width="4.3%">id_col1</th> <th data-column-id="id_col2" data-order="desc" data-width="4.3%">id_col2</th> <th data-column-id="id_col3" data-order="desc" data-width="4.3%">id_col3</th> </tr> </thead> </table>
/ / --------------------------------------------- -
var check_first_load = 0; //--> for set default column. $("#grid-keep-selection").bootgrid({ ajax: true, post: function () { return { id: "xx" }; }, url: "api/data/xx.php", formatters: { "commands": function(column, row) { return '<a> xxx </a>'; } } ,labels: { noResults: "where are my results" } }).on("loaded.rs.jquery.bootgrid", function() { //--> for set default hiding column. if(check_first_load == 0){ check_first_load++; $('input[name=id_col1]').trigger("click"); $('input[name=id_col2]').trigger("click"); $('input[name=id_col3]').trigger("click"); } });
Ruthe
source share