jquery通过把json数据转换输出为table表格插件

所属分类: 网页特效-实用工具    2023-08-03 10:39:40

jquery通过把json数据转换输出为table表格插件 ie兼容6
 查看演示  登录后下载 温馨提示
登录会员即可享受免费下载
 我要建站

jquery通过把json数据转换输出为table表格插件(共9个文件)

    • index.html

使用方法

		$(document).ready(function() {
			var arr = [
					[1, 2, 3],
					["one", "two", "three"]
			];

      /* Array To Table */
      var input = JSON.stringify(arr);
			$("#jsontotable-arr")
        .append($("

").html("Array To Table")) .append($("

").html("Input")) .append($("").html(input)) .append($("

").html("Output")); $.jsontotable(arr, { id: "#jsontotable-arr", header: true }); /* Array To Table (Without Header) */ $("#jsontotable-arr") .append($("

").html("Array To Table (Without Header)")) .append($("

").html("Input")) .append($("").html(input)) .append($("

").html("Output")); $.jsontotable(arr, { id: "#jsontotable-arr", header: false }); var obj = [ {"Title1": "Hello", "Title2": "Fine", "Title3": "Thank you"}, {"Title1": "안녕하세요", "Title2": "좋아요", "Title3": "감사합니다"}, {"Title1": "こんにちは", "Title2": "ファイン", "Title3": "ありがとう"}, {"Title1": "你好", "Title2": "精", "Title3": "谢谢"}, {"Title1": "Bonjour", "Title2": "Beaux", "Title3": "Merci"}, {"Title1": "Ciao", "Title2": "Bene", "Title3": "Grazie"} ]; /* JSON To Table (Has Header) */ input = JSON.stringify(obj); $("#jsontotable-obj") .append($("

").html("JSON To Table (Has Header)")) .append($("

").html("Input")) .append($("").html(input)) .append($("

").html("Output")); $.jsontotable(obj, { id: "#jsontotable-obj" }); /* JSON To Table (Without Header) */ $("#jsontotable-obj") .append($("

").html("JSON To Table (Without Header)")) .append($("

").html("Input")) .append($("").html(input)) .append($("

").html("Output")); $.jsontotable(obj, { id: "#jsontotable-obj", header: false }); var objmissing = [ {"Title1": "Hello", "Title2": "Fine", "Title3": "Thank you"}, {"Title1": "안녕하세요", "Title2": "좋아요", "Title3": "감사합니다"}, {"Title4": "こんにちは", "Title2": "ファイン", "Title5": "ありがとう"}, {"Title1": "你好", "Title5": "精", "Title3": "谢谢"}, {"Title5": "Bonjour", "Title4": "Beaux", "Title3": "Merci"}, {"Title1": "Ciao", "Title6": "Bene", "Title7": "Grazie"} ]; /* JSON To Table (Has Header and Missing some columns in body */ input = JSON.stringify(objmissing); $("#jsontotable-obj") .append($("

").html("JSON To Table (Has Header and Missing some columns in body)")) .append($("

").html("Input")) .append($("").html(input)) .append($("

").html("Output")); $.jsontotable(objmissing, { id: "#jsontotable-obj" , header: true }); var objwithdata = [ { id: "header", "class": "header-class", _data:{"Title1": "안녕하세요", "Title2": "좋아요", "Title3": "감사합니다"} }, {"Title1": "안녕하세요", "Title2": "좋아요", "Title3": "감사합니다"}, {"Title1": "こんにちは", "Title2": "ファイン", "Title3": "ありがとう"}, {"Title1": "你好", "Title2": "精", "Title3": "谢谢"}, {"Title1": "Bonjour", "Title2": "Beaux", "Title3": "Merci"}, {"Title1": "Ciao", "Title2": "Bene", "Title3": "Grazie"} ]; /* JSON To Table with _data attribute (Has Header) */ input = JSON.stringify(objwithdata); $("#jsontotable-objwithdata") .append($("

").html("JSON To Table with _data attribute (Has Header)")) .append($("

").html("Input")) .append($("").html(input)) .append($("

").html("Output")); $.jsontotable(objwithdata, { id: "#jsontotable-objwithdata" }); /* JSON To Table with _data attribute (Without Header) */ $("#jsontotable-objwithdata") .append($("

").html("JSON To Table with _data attribute (Without Header)")) .append($("

").html("Input")) .append($("").html(input)) .append($("

").html("Output")); $.jsontotable(objwithdata, { id: "#jsontotable-objwithdata", header: false }); var str = "[\ {\"Title1\": \"Hello\", \"Title2\": \"Fine\", \"Title3\": \"Thank you\"}, \ {\"Title1\": \"안녕하세요\", \"Title2\": \"좋아요\", \"Title3\": \"감사합니다\"}, \ {\"Title1\": \"こんにちは\", \"Title2\": \"ファイン\", \"Title3\": \"ありがとう\"}, \ {\"Title1\": \"你好\", \"Title2\": \"精\", \"Title3\": \"谢谢\"}, \ {\"Title1\": \"Bonjour\", \"Title2\": \"Beaux\", \"Title3\": \"Merci\"}, \ {\"Title1\": \"Ciao\", \"Title2\": \"Bene\", \"Title3\": \"Grazie\"} \ ]"; /* JSON (String Format) To Table" */ $("#jsontotable-str") .append($("

").html("JSON (String Format) To Table")) .append($("

").html("Input")) .append($("").html(input)) .append($("

").html("Output")); $.jsontotable(str, { id: "#jsontotable-str", className: "table table-bordered table-striped" }); });

站长提示:
1. 苦力吧素材官方QQ群:950875342
2. 平台上所有素材资源,需注册登录会员方能正常下载。
3. 会员用户积极反馈网站、素材资源BUG或错误问题,每次奖励2K币
4. PHP源码类素材,如需协助安装调试,或你有二次开发需求,可联系苦力吧客服。
5. 付费素材资源,需充值后方能下载,如有任何疑问可直接联系苦力吧客服
相关资源 / 实用工具

jquery将PPTX转换成HTML网页显示插件

基于jQuery的PPTX到HTML转换器,可将Microsoft PowerPoint文件转换为HTML以供进一步使用。
  实用工具
 4560  0

html5在线可视化流程图简易绘图工具代码

一款在线绘图实用工具插件,可绘制基础的流程图及简单的结构图,很实用!
  实用工具
 7349  0

jquery结构化数据转换器工具插件

一个JavaScript库,可以创建Turtle(Terse RDF Triple Language)到JSON-LD的结构化数据转换器。
  实用工具
 7251  0

javascript自定义九宫格网格验证码插件

一款安全性高的网格验证码特效,自动生成一个随机的带字母数字网格,并标记需要输入的网格中字符,还带了实时输入验证,很有创意。
  实用工具
 4280  0

评论数(0) 回复有机会获得K币 用户协议

^_^ 还没有人评论,快来抢个沙发!
😀
  • 😀
  • 😊
  • 😂
  • 😍
  • 😑
  • 😷
  • 😵
  • 😛
  • 😣
  • 😱
  • 😋
  • 😎
  • 😵
  • 😕
  • 😶
  • 😚
  • 😜
  • 😭
发表评论