javascript - Error with list.js sortable table -
when using list.js , tabletop sortable table taken gdoc, error: "uncaught typeerror: cannot read property 'childnodes' of undefined" on first line of list.js.
because website work can have js uploaded, need write html using js or jquery, it's bit wonky. think error beingness thrown because of order have everything, have tried moving things around no avail. working other sorting.
thanks!
html file
<!doctype html> <html> <head> <link rel="stylesheet" type="text/css" href="styles.css"> <script type="text/javascript" src="list.js-master/dist/list.min.js"></script> <script type="text/javascript" src="src/tabletop.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> </head> <body> <div id="tablesetter"></div> </body> <script type="text/javascript"> var url = 'url gdoc here'; $(document).ready( function(){ tabletop.init( {key: url, callback: showinfo, parsenumbers: true} )}) function showinfo(data, tabletop){ $("#tablesetter").append('<h2>table working</h2><table><thead><th class="sort" data-sort="university">university</th><th class="sort" data-sort="no">billionaires</th><th class="sort" data-sort="no2">billionaires rank</th><th class="sort" data-sort="rank">u.s. news rank</th></thead><tbody class="list"></tbody></table>'); $.each(tabletop.sheets("sheet1").all(), function(i, cat){ var htmltable = $('<tr><td class="university">' + cat.university + '</td>'); htmltable.append('<td class="no">' + cat.numberofbillionaires + '</td>'); htmltable.append('<td class="no2">' + cat.rankedbybillionaires + '</td>'); htmltable.append('<td class="rank">' + cat.usnewsranking + '</td></tr>'); htmltable.appendto("tbody"); }) } </script> <script type="text/javascript" src="options.js"></script> </html>
js file
var options = { valuenames: [ 'university', 'no' , 'no2' , 'rank'] }; var userlist = new list('tablesetter', options);
if @ post, i'm sure missing of minimum requirements list.js function properly. seek dynamically add together input id , class of "search" other classes. allow me know if helps.
http://stackoverflow.com/a/23078200/4812515
javascript jquery html listjs
No comments:
Post a Comment