{"id":931,"date":"2014-03-05T07:46:53","date_gmt":"2014-03-05T07:46:53","guid":{"rendered":"http:\/\/blog.zhukunqian.com\/?p=931"},"modified":"2014-03-05T10:29:53","modified_gmt":"2014-03-05T10:29:53","slug":"%e6%89%be%e5%88%b0%e4%b8%80%e4%b8%aa%e7%bc%96%e8%be%91json%e8%a1%a8%e6%a0%bcajax-grid%e6%8e%a7%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/blog.zhukunqian.com\/?p=931","title":{"rendered":"\u627e\u5230\u4e00\u4e2a\u7f16\u8f91json\u8868\u683cajax grid\u63a7\u4ef6"},"content":{"rendered":"<blockquote class=\"wp-embedded-content\" data-secret=\"YdnLTDBCqI\"><p><a href=\"https:\/\/www.jqwidgets.com\/\">jQuery UI Widgets<\/a><\/p><\/blockquote>\n<p><iframe class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;jQuery UI Widgets&#8221; &#8212; Angular, Vue, React, Web Components, Javascript, HTML5 Widgets\" src=\"https:\/\/www.jqwidgets.com\/embed\/#?secret=YdnLTDBCqI\" data-secret=\"YdnLTDBCqI\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<p>\u7b56\u5212\u8fd8\u662f\u6bd4\u8f83\u559c\u6b22\u539f\u6765\u7684\u7c7b\u4f3c\u8868\u683c\u6765\u7f16\u8f91\uff0c\u4e0d\u559c\u6b22\u76f4\u63a5\u7f16\u8f91json\u683c\u5f0f\u3002<\/p>\n<p>\u5728\u7f51\u4e0a\u627e\u5230\u4e86jqwidgets\uff0c\u91cc\u9762\u7684grid\u63a7\u4ef6\u6b63\u597d\u6ee1\u8db3\u9700\u6c42\u3002<\/p>\n<pre class=\"brush: javascript; gutter: true\">&lt;script type=&quot;text\/javascript&quot;&gt;\r\n        $(document).ready(function () {\r\n        \tvar url=&#039;&lt;c:url value=&#039;\/gm\/Gm\/readParameter?id=${parameter.id}&#039;\/&gt;&#039;;\r\n            var source =\r\n            {\r\n                datatype: &quot;json&quot;,\r\n                datafields: [\r\n                    { name: &#039;id&#039;, type: &#039;int&#039; },\r\n                    { name: &#039;name&#039;, type: &#039;string&#039; },\r\n                    { name: &#039;gmLoginUrl&#039;, type: &#039;string&#039; },\r\n                    { name: &#039;ip&#039;, type: &#039;string&#039; },\r\n                    { name: &#039;port&#039;, type: &#039;int&#039; },\r\n                    { name: &#039;status&#039;, type: &#039;int&#039; },\r\n                    { name: &#039;recommend&#039;, type: &#039;bool&#039; }\r\n                ],\r\n                id: &#039;id&#039;,\r\n                url: url\r\n            };\r\n            var dataAdapter = new $.jqx.dataAdapter(source);\r\n            $(&quot;#jqxgrid&quot;).jqxGrid(\r\n            {\r\n                width: 1200,\r\n                source: dataAdapter,\r\n                columnsresize: true,\r\n                editable: true,\r\n                columns: [\r\n                  { text: &#039;id&#039;, datafield: &#039;id&#039;, width: 50 },\r\n                  { text: &#039;name&#039;, datafield: &#039;name&#039;, width: 150 },\r\n                  { text: &#039;ip&#039;, datafield: &#039;ip&#039;, width: 120 },\r\n                  { text: &#039;port&#039;, datafield: &#039;port&#039;, minwidth: 120 },\r\n                  { text: &#039;\u72b6\u6001&#039;, datafield: &#039;status&#039;, minwidth: 50 },\r\n                  { text: &#039;\u63a8\u8350&#039;, datafield: &#039;recommend&#039;, maxwidth: 50,columntype: &#039;checkbox&#039; },\r\n                  { text: &#039;\u540e\u53f0\u8fde\u63a5&#039;, datafield: &#039;gmLoginUrl&#039;, width: 280 }\r\n                ]\r\n            });\r\n            $(&quot;#jsonExport&quot;).jqxButton({});\r\n            $(&quot;#jsonExport&quot;).click(function () {\r\n                var gridContent=$(&quot;#jqxgrid&quot;).jqxGrid(&#039;exportdata&#039;, &#039;json&#039;);\r\n                $(&quot;#editParameterForm_json&quot;).val(gridContent);\r\n                $(&quot;#editParameterForm&quot;).submit();\r\n            });\r\n        });&lt;\/script&gt;<\/pre>\n<p>\u5728\u4f7f\u7528grid\u5bfc\u51fajson\u65f6\uff0c\u6570\u5b57\u88ab3\u4e2a\u4e00\u7ec4\u5206\u7ec4\u4e86\uff0c12345\u88ab\u683c\u5f0f\u5316\u4e3a 12,345 \u751f\u6210\u540e\u9762\u4e00\u5806\u9519\u8bef\u3002<\/p>\n<p>\u6700\u7ec8\u672a\u627e\u5230\u7684\u5b8c\u7f8e\u7684\u89e3\u51b3\u65b9\u5f0f\uff0c\u53ea\u597d\u8bbe\u7f6e\u8fd9\u4e00\u5217\u4e3a\u5b57\u7b26\u4e32\uff0c\u907f\u514d\u88ab\u5206\u7ec4\u3002<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>jQuery UI Widgets \u7b56\u5212\u8fd8\u662f\u6bd4\u8f83\u559c\u6b22\u539f\u6765\u7684\u7c7b\u4f3c\u8868\u683c\u6765\u7f16\u8f91\uff0c\u4e0d\u559c\u6b22 &hellip;<\/p>\n<p class=\"read-more\"><a href=\"https:\/\/blog.zhukunqian.com\/?p=931\">\u7ee7\u7eed\u9605\u8bfb &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/posts\/931"}],"collection":[{"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=931"}],"version-history":[{"count":3,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/posts\/931\/revisions"}],"predecessor-version":[{"id":936,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/posts\/931\/revisions\/936"}],"wp:attachment":[{"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=931"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=931"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=931"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}