how to refresh yui3 datatable with updated json data
-
28-06-2021 - |
문제
I want to refresh datatable using new data in json format.
I tried using below method but it is giving error mentioned
var myData = table.get('data');
myData.add(json_data);
Error in console log:
invalid 'in' operand config
userTargets = (config && BUBBLETARGETS in config);
Please can someone shed some light if there's any other menthod to refresh yui3 datatable using new data
Thanks in advance.
해결책 2
It worked fine when I used eval to json_data (which was encoded in Perl from string into Json format)
table.set('data', eval(json_data));
다른 팁
It sounds like the json data you're passing it isn't an array of objects. Maybe it's an object with the array of objects nested inside somewhere?
At any rate, you can do
table.set('data', json_data.path.to.resultArray);
If you want to append more records to the table, try
table.addRows(json_data.path.to.resultArray);
HTH
제휴하지 않습니다 StackOverflow