I have scoured the internet and looked for how to use the bootstrap-table to send a simple object to the server using the ajaxOptions data property during it's request. The examples that are available have either been removed or just don't seem to work as I would expect.
I have the following code
var obj = { "Facilities": ['1234', '123456'] };
$('#tablePolicies').bootstrapTable({
url: '/api/PolicyConfigurationAPI/getPoliciesInFacilities',
method:"POST",
ajaxOptions: {data: JSON.stringify(obj)},
showFilter: true,
idField: 'PolicyID',
columns: [{
field: 'state',
checkbox: true
},
{
field: 'Description',
title: 'Description',
sortable: true
}]
})
Calling the following c# mvc service...
public HttpResponseMessage getPoliciesInFacilities(List Facilities) //this does have string in <> but the stackoverflow viewer has removed it
{}
I have tried several different combinations of options and the custom ajax call back/override.
However, I look in f12 and see the only data being sent is the standard (limit=10&offset=0&sort=id&order=asc)
What am I missing? I'm sure it must be simple, any help greatly appreciated.
Note: This works when using an extra $.ajax call and providing the returned json data to the data property of the table constructor, however this the fails to initialise the filters from bootstrap-table-filter'
Thanks
Ted
See this example where you can find a example code: http://issues.wenzhixin.net.cn/bootstrap-table/#issues/152.html