The example in this article describes the method for dynamically creating a complex table table Jquery+json implementation. Share to everyone for your reference, specific as follows:
function setsubtable () {var obj = Jquery.parsejson ($ ("#SubJsonStrValue"). Val ()); Window.
Allparamters = obj;
var row_str = ""; var span_num = 1 for (var i = 0; i < obj.length; i++) {if (obj[i). Paramnames.length > 0) {row_str = ' <tr><td rowspan= ' + obj[i]. Paramnames.length + ' "><input type=" checkbox "Name=" _ ' +obj[i]. Id+ ' "/> ' + obj[i].
Name + ' </td> '; for (var j = 0; J < Obj[i]. Paramnames.length;
J + +) {if (J!= 0) {row_str + = "<tr>"; } row_str + = ' <td><input type= checkbox ' name= ' p_ ' +obj[i '. PARAMNAMES[J]. Id+ ' _ ' +obj[i]. Id+ ' "/> ' + obj[i]. PARAMNAMES[J].
Name + ' </td><td> '; for (var k = 0; k < obj[i]. PARAMNAMES[J]. Listitems.length; k++) {row_str + = Obj[i]. PARAMNAMES[J]. LISTITEMS[K].
Name+ "|";}
Row_str = row_str.substring (0, row_str.length-2);
Row_str = "</td><td>"; if (obj[i). PARAMNAMES[J]. CanmulTISELECTE) {row_str + = "multiple selection";
else {row_str = "single election";
Row_str + = "</td></tr>";
} $ ("#sub_table_header"). After (ROW_STR);
}
PS: About JSON operation, here we recommend a few more practical JSON online tools for your reference to use:
Online JSON code inspection, inspection, landscaping, formatting tools:
Http://tools.jb51.net/code/json
JSON Online formatting tool:
Http://tools.jb51.net/code/jsonformat
Online Xml/json Mutual Conversion tool:
Http://tools.jb51.net/code/xmljson
JSON code online Format/beautify/compress/edit/Convert tools:
Http://tools.jb51.net/code/jsoncodeformat
Online JSON compression/escape tool:
Http://tools.jb51.net/code/json_yasuo_trans
C Language Style/html/css/json code formatting landscaping Tools:
Http://tools.jb51.net/code/ccode_html_css_json
More interested readers of jquery-related content can view this site: "jquery form Operation Summary", "jquery common Plug-ins and Usage summary", "jquery Ajax Usage Summary", "jquery table (table) Operation Tips Summary", " jquery drag-and-drop effects and tips summary, "jquery Extended Tips", "jquery common Classic Effects Summary", "jquery animation and special effects usage Summary" and "jquery Selector usage Summary"
I hope this article will help you with the jquery program design.