Suppose I fetched the data from api and during sort, don't want to hit the api please help if it is possible in bootgrid like datatable.
I have this function for bootgrid load can please help on this.
function generateBootGrid(pd) {
$(pd.gridId).bootgrid({
ajax: true,
rowSelect: true,
navigation: 0,
sort: true,
search: false,
post: function ()
{
/* To accumulate custom parameter with the request object */
return getCustomPramas();
},
url: baseUrl + pd.fireUrl+'?get_of_year='+$('#get_of_year').val(),
templates: {
search: ""
},
responseHandler: function (data) {
console.log(data);
$(pd.totalPriceId).html(data.totalCost);
return data;
},
formatters: {
"commands": function (column, row)
{
return "<button type=\"button\" class=\"btn btn-xs btn-default " + pd.editButtonClass + "\" data-row-id=\"" + row.id + "\"><span class=\"glyphicon glyphicon-edit\"></span></button> ";
}
}
})
requiredBootGridParms = {
gridId: "#educational-expenses",
fireUrl: "/pedagogical-action/get-educational-expenses/",
totalPriceId: "#totalEduCost",
editButtonClass: "command-edit",
};
generateBootGrid(requiredBootGridParms);
This is the html for this grid
<table id="educational-expenses" class="table table-condensed table-hover table-striped" width="60%" cellspacing="0" >
<thead>
<tr>
<th data-column-id="account_number" data-type="numeric" data-identifier="true">Account Number</th>
<th data-column-id="account_name" data-order="desc">Account Name</th>
<th data-column-id="amount">Amount</th>
</tr>
</thead>
</table>
<button type="button" class="btn btn-xs btn-primary" id="command-add" data-row-id="0">
<span class="glyphicon glyphicon-plus"></span></button>
<span class="text-danger float-right">Total educational costs - A: <span class="text-danger" id="totalEduCost">00.00</span></span>
Thanks