I am using bootstrap-table by wenzhixin on Github it is this one
I want to change table settings from clickToSelect: true
to clickToSelect: false
on refresh
Here is my Code :
HTML
<html>
<button id="refresh"> Refresh
</button>
<table id="table">
</table>
<html>
JAVASCRIPT
$(function () {
$('#table').bootstrapTable({
method: 'get',
url:"http://139.199.18.128/Home/GetJSON2",
clickToSelect: true,
columns: [
{ checkbox: true },
{ field: "name", title: "lon"},
{ field: "customID", title: "level"}
]
});
$("#refresh").click(function () {
$("#table").bootstrapTable("refresh",
{
});
});
});
$("#table").bootstrapTable("refresh",
{ method: 'post',
url: "myUrl",
clickToSelect: false
});
I hope I can get a solution. Thanks.
Why is the call with refreshOptions outside of refresh button handler ? Try like this:
$(function() {
$('#table').bootstrapTable({
method: 'get',
url: "http://139.199.18.128/Home/GetJSON2",
clickToSelect: true,
columns: [{
checkbox: true
},
{
field: "name",
title: "lon"
},
{
field: "customID",
title: "level"
}
]
});
$("#refresh").click(function() {
$("#table").bootstrapTable("refreshOptions", {
clickToSelect: false,
// Other options you want to override
});
});
});
EDIT
If you want only to change clickToSelect field, check this: http://jsfiddle.net/edvejew5/
If you want to disable/enable the checkboxes, check this: http://jsfiddle.net/j9h62fk6/ ( could be much cleaner, but it's a start)