it loads data successfully when the data is static. But I need the data from the server side and it failed.
code:
var $table=$(“#table”)
var token = $.cookie("gojiajuToken");
$(function () {
$table.bootstrapTable(
Here I replace url with a static data,it works perfectly
url: Store_Service_Url+ "store/custom_category",
method: "GET",
idField: "id",
ajaxOptions: {
headers: { "Authorization": "Bearer " + token }
},
The responseHandler receives data successfully
responseHandler: function (res) {
console.log("response res")
console.log(res)
return res.data
},
columns: [{
field: 'category',
title: 'name',
valign: "middle",
align: "left",
width: 120
},
{
field: "id",
formatter: "delete2",
valign: "middle",
width: 120,
align: "middle"
}
],
This part decide the expanded columns and its parent id
treeShowField:"category",
parentIdField:"parentID",
onResetView: function (data) {
$table.treegrid({
initialState: 'expanded',
treeColumn: 0,
onChange: function () {
$table.bootstrapTable('resetWidth');
}
});
}
})
the sample data will be like
var list = [{
'category': "test1",
'comment': "",
'id': "1”
'parentID': "",
'sortIndex': 0
},
{
category: "test2",
'comment': "",
'id': "2",
'parentID': "",
'sortIndex': 0
}, {
category: "test3",
'comment': "",
'id': "3",
'sortIndex': 0
}]
really need help!