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简单的Bootstrap在线计算器插件

一款响应式在线计算器插件,包含有:加减乘除计算,高效快速很实用。
  实用工具
 6669  0

javascript可自定义规则的密码生成器插件

一款在线密码生成器工具,支持自定义密码长度和并设置(小写、大写、数字、特殊符号),核心功能是根据用户定义的规则生成随机安全的密码。支持在线滑动进度条设置密码位数,选择不同的字符组合,点击按钮即可生成,带自动复制密码功能。
  实用工具
 3691  0

jquery功能丰富的图片自由拖拽插件

一款超实用的鼠标拖拽在线工具,可自由地拖拽网页上的任意元素,还控制的方向,比如只允许:水平拖拽、垂直拖拽,还可设置拖拽的hander,即鼠标在某区域是触发拖拽事件。
  实用工具
 8611  0

jquery纯数字变英文单词转换器插件

一个数字到单词转换器,它将任何数字和货币值自动转换为与之相匹配的英文单词。
  实用工具
 4823  0

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

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