Jquery+json implement a method for dynamically creating a complex table table _jquery

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.