Well, I have configured my bootstrap table to show the refresh button in the toolbar.
data-show-refresh="true"
The data-url table property is correctly configured. Proof of this is that the table is filled correctly when you load the page. Besides, I have verified that the corresponding method of the controller is reached
But if you hit the refresh button on the toolbar, this happens:
We reach the correct method of the correct controller, a correct model is generated, a correct json is created from that correct model, this json reaches the user (I check it from the browser), but the table does not update the data that has changed DB.
In any case, it is strange, when I hit refresh, although it does nothing, the table momentarily remains blank and then the data appears again. As if it had refreshed something, but no.
If I reload the page (and return just a View(“myview”,model), not a Json(model)), the updated values will be displayed. I can’t find the error, if you could help me, I would appreciate it.
I had thought about making a fiddle so you could see it online, but I don’t know how to change the data that I will pass to the table. If you know of any website that has this function, tell me and I will do it.
Reading the documentation, I have seen how, from an event in jquery, a refresh of the table is generated. I do not prefer to do that.
It is not possible to use the toolbar refresh button, included in this bootstrap table??? I have tried to reach this button from JS, to generate the refresh myself ($table.bootstrapTable('refresh')
), but it has been impossible for me to obtain this button from the DOM.
<table id="tbl" class="table table-bordered table-striped table-hover"
data-locale="es-ES"
data-toolbar="#toolbar"
data-toggle="table"
data-search="false"
data-show-refresh="true"
data-show-toggle="true"
data-show-fullscreen="true"
data-show-columns="true"
data-show-columns-toggle-all="true"
data-detail-view="false"
data-show-export="true"
data-export-types="['json', 'xml', 'csv' , 'txt' , 'sql', 'xlsx' , 'pdf' ]"
data-export-data-type="all"
data-click-to-select="false"
data-minimum-count-columns="2"
data-show-pagination-switch="false"
data-pagination="true"
data-side-pagination="client"
data-page-list="[10, 25, 50, 100, all]"
data-show-footer="true"
data-filter-control="true"
data-show-search-clear-button="true"
data-url="/Home/Method">
<thead style="background-color: rgba(200, 200, 200, 0.8);">
<tr>
<th data-field="property1" data-sortable="true" data-switchable="false" data-filter-control="input">property1</th>
<th data-field="property2" data-sortable="true" data-switchable="false" data-filter-control="input">property2</th>
</tr>
</thead>
<tbody id="tbl_bod" style="background-color: rgba(255, 255, 255, 0.8);">
@if (Model != null && Model.items != null)
{
@foreach (Class1 obj in Model.items)
{
<tr>
<td>@obj.property1</td>
<td>@obj.property2</td>
</tr>
}
}
</tbody>
</table>
Any idea? Do you know what could be happen? Many Thanks