Closed BenJule closed 9 years ago
Ok, let me check! @BenJule
Thanks for helping. The file "nodes.json" is automatically generated. I can not change the structure.
I think the problem is that your ,json file is not a flat json.. you can use this extension to do that https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/flatJSON and here is the example: http://issues.wenzhixin.net.cn/bootstrap-table/#extensions/flatJSON.html
@BenJule
TypeError: $.fn.bootstrapTable is undefined My nodes.html: http://paste.debian.net/hidden/f73cc344/ My nodes.json: http://paste.debian.net/hidden/a38bdf4f/ The Problem is, the structure of json file, example.json is working fine but with my json file, it gives trouble!
@djhvscf
Ok, let me check again! @BenJule
@djhvscf i have find the trouble. Please check my nodes.json:
Were can i change the option from "rows": [ to "nodes": [ ?
I think the flatJSON extension works for you. @BenJule
not realy. i need to change the read option from "rows": [ to "nodes": [ but i dount know, were can i find it :/ http://paste.debian.net/hidden/4cbb16f8/ is (working) http://paste.debian.net/hidden/bf080cf1/ is (not working) @djhvscf
Do you mean change the word "rows" to "nodes" and no change the struture of the json? @BenJule
:+1:
Am I correct?
yes
ok, got it.. let me think what we can do with this problem
the funktion "rows" is not hardcoded?
Now I'm understanding the problem is related to this line..
data = data.rows;
in file?
As far I can understand I think is related to this function:
BootstrapTable.prototype.load = function (data) {
var fixedScroll = false;
// #431: support pagination
if (this.options.sidePagination === 'server') {
this.options.totalRows = data.total;
fixedScroll = data.fixedScroll;
data = data.rows;
} else if (!$.isArray(data)) { // support fixedScroll
fixedScroll = data.fixedScroll;
data = data.data;
}
this.initData(data);
this.initSearch();
this.initPagination();
this.initBody(fixedScroll);
};
ahhh thanks @djhvscf , i have found the solution.
Can you tell us what is your solution? @BenJule
I was change the line data = data.rows; -> data = data.nodes;
BootstrapTable.prototype.load = function (data) {
var fixedScroll = false;
// #431: support pagination
if (this.options.sidePagination === 'server') {
this.options.totalRows = data.total;
fixedScroll = data.fixedScroll;
data = data.rows; // <-- related this function
} else if (!$.isArray(data)) { // support fixedScroll
fixedScroll = data.fixedScroll;
data = data.data;
}
this.initData(data);
this.initSearch();
this.initPagination();
this.initBody(fixedScroll);
};
Ok, I think we have to review that method because is not a common solution for all us! Thank you!
There is an option: responseHandler
, and it can easy to resolve your problem:
responseHandler: function (res) {
return res.nodes;
}
PS: it is not recommended to modify the source code. Here is the Docs. The example: http://issues.wenzhixin.net.cn/bootstrap-table/#353.html. The json: https://github.com/wenzhixin/bootstrap-table-examples/blob/master/json/353.json.
Hi @djhvscf & @wenzhixin
The option responseHandler
isnt working!
responseHandler: function (res) {
return res.nodes;
}
Please check my Site: http://benjule.github.io/project-categories/bootstrap-table-test/ and my github.io: https://github.com/BenJule/benjule.github.io
What exactly do we have to see??
I have the same problem.
@djhvscf please see, http://benjule.github.io/project-categories/bootstrap-table-test/
there is no output with tables!
First error.. No including the jQuery reference..
Review this, please.
omg, thanks @djhvscf
@wenzhixin @djhvscf my json format was changed :-1: New Format: https://gist.github.com/BenJule/06c23346bc6995f82333. Its possible to read this format?
Of course.. you can use the flatJSON extension to read the JSON.. See this: http://issues.wenzhixin.net.cn/bootstrap-table/#extensions/flatJSON.html and this: https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/flatJSON
@djhvscf there isnt working, see http://gw3.ff3l.fr/?page=test the jsonfile is differen as example data3.json
What about your table config?
No matching records found!
<table id="table"
data-toggle="table"
data-flat="true"
data-search="true"
data-url="./db/ff3l.json">
<thead>
<tr>
<th data-field="hostname" data-sortable="true">Hostname</th>
<th data-field="uptime" data-sortable="true">Uptime</th>
<th data-field="tx" data-sortable="true">TX(MB)</th>
<th data-field="rx" data-sortable="true">RX(MB)</th>
<th data-field="firmware" data-sortable="true">Firmware</th>
<th data-field="model" data-sortable="true">Model</th>
<th data-field="autoupdate" data-sortable="true">Autoupdate</th>
<th data-field="loadavg" data-sortable="true">Load AVG</th>
<th data-field="memfree" data-sortable="true">Mem Free</th>
</tr>
</thead>
</table>
Let me check it
Hi togeher,
My Files
nodes.json: http://paste.debian.net/hidden/85d8c632/ getData.html: http://paste.debian.net/hidden/b9df2a32/ welcome.html http://paste.debian.net/hidden/10c94b9b/
Problem
No matching records found!
Anyone ideas?