How can I use the database plugin with more tables generated by JavaScript code on a page? Two of the three tables are sung and in the wrong order.
var keyword 1 = JSON.parse ("{\" 1 \ ": [\" lor \ "], \" 2 \ ": [\" ("{\" 1 \ ": [\" bachelor \ "], \" 2 \ ") Var keywords3 = JSON.parse ("{\" 1 \ ": [\" b \ "], \ [\" mber \ "], \" 3 \ ": [\" pleasant \ "] CreateKeywordTableString (keywords1); buildKeywordTableString (keywords3); FunctionBaltwordwordable string ) {Var keyword table string = '& lt; table cellpadding = "0" cellspacing = "0" range = "0" class = "display" id = "example"> gt; & lt; / table & gt;'; Var key = Object key (keyword); Var dataset = new array (); for (var i = 0; i & lt; keys.length; i ++) {for (var j = 0; j & lt; keyword [keys [i]] length; J ++) {var row = new array (); row.push (keywords [key [i]] [j]); row.push (key [i]); dataSet.push (line);}} $ ( '# Examples'). DataTable ({"Data": Dataset, "Columns": [{"Title": "Key"}, {"Title": "R"}]}); Document.body.innerHTML = KeywordsTableString + document.body.innerHTML; }
Thanks for any help.
Every time the buildkeyword breaks ()
Creates another table with "Example" , which is incorrect because the ID should be unique, it is uncertain that the node will get $ ('# example')
.
You can actually create a new table and prepaid it, and apply the data to the id without the data.
Create the function of the keywordTable string (keyword) {var keys = Object.keys (keyword); Var dataset = []; (Var i = 0; i & lt; keys.length; i ++) {for (var j = 0; j & lt; keyword [keys [i]]. Length; j ++) {dataSet.push ([Keyword [keys] [i]] [j], key [i]]); }} $ ('& Lt; table cellpadding =' 0 "cellpacing =" 0 "limit =" 0 "square =" display "> gt; & lt; / table & gt; ') .prependTo (" body "). DataTel ({"Data": Dataset, "Column": [{"Title": "Key"}, {"Title": "R"}]})}}
At least you should give a chance to fight.
Comments
Post a Comment