{"id":540,"date":"2012-11-02T19:30:12","date_gmt":"2012-11-02T11:30:12","guid":{"rendered":"http:\/\/blog.amjet.cc\/IT\/?p=540"},"modified":"2014-10-23T10:15:01","modified_gmt":"2014-10-23T02:15:01","slug":"dwr-jquery-plugin-datatables-%e6%95%b4%e5%90%88","status":"publish","type":"post","link":"https:\/\/blog.amjet.biz\/IT\/?p=540","title":{"rendered":"DWR + JQuery plugin datatables \u6574\u5408"},"content":{"rendered":"<p>\u9996\u5148\u8981\u5b9a\u7fa9\u4e00\u500b datatables \u7684\u5143\u4ef6\u5982\u4e0b\uff1a<\/p>\n<p>&lt;table id=&#8221;myTable&#8221;&gt;<br \/>\n&lt;thead&gt;&lt;\/thead&gt;<br \/>\n&lt;tbody&gt;&lt;\/tbody&gt;<br \/>\n&lt;\/table&gt;<\/p>\n<p>DWR \u6bd4\u8f03\u5c37\u5c2c\u7684\u662f\u4e00\u822c Ajax \u5143\u4ef6\u90fd\u662f\u8981\u4f60\u63d0\u4f9b\u4e00\u500b URL \u4ed6\u81ea\u5df1\u6703\u53bb\u6293 json \u683c\u5f0f\u8cc7\u6599\u56de\u4f86\uff0cDWR \u6c92\u8fa6\u6cd5\u63d0\u4f9b\u4f60\u9019\u6a23\u7684 URL\uff0c\u4ed6\u662f\u76f4\u63a5\u56de\u50b3 javascript \u7269\u4ef6\u7d66\u4f60\uff0c\u5e78\u597d datatables \u4e5f\u53ef\u4ee5\u62ff javascript \u7269\u4ef6\u8cc7\u6599\u4f86\u7528\u3002<\/p>\n<p>\u9996\u5148 initialize datatable<\/p>\n<p>$(document).ready(function() {<br \/>\n$(&#8216;#myTable&#8217;).dataTable( {<br \/>\naoColumns: [<br \/>\n{sTitle: &#8220;\u7528\u6236&#8221;},<br \/>\n{sTitle: &#8220;\u96fb\u8a71&#8221;}<br \/>\n]<br \/>\n} );<br \/>\n} );<\/p>\n<p>\u518d\u4f86\u628a callback \u6536\u5230\u7684\u8cc7\u6599\u585e\u9032 datatable \u5373\u53ef<\/p>\n<p>myDWRInterface.query( {<br \/>\ncallback: function(result) {<br \/>\nvar dt=$(&#8216;#myTable&#8217;).dataTable();<br \/>\ndt.fnClearTable();<br \/>\ndt.fnAddData(result,true);<br \/>\n}<br \/>\n});<\/p>\n<p>&nbsp;<\/p>\n<p>[ratings]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148\u8981\u5b9a\u7fa9\u4e00\u500b datatables \u7684\u5143\u4ef6\u5982\u4e0b\uff1a &lt;table id=&#8221;myTable&#8221;&gt; &lt;thead&gt;&lt;\/thead&gt; &lt;tbody&gt;&lt;\/tbody&gt; &lt;\/table&gt; DWR \u6bd4\u8f03\u5c37\u5c2c\u7684\u662f\u4e00\u822c Ajax \u5143\u4ef6\u90fd\u662f\u8981\u4f60\u63d0\u4f9b\u4e00\u500b URL \u4ed6\u81ea\u5df1\u6703\u53bb\u6293 json \u683c\u5f0f\u8cc7\u6599\u56de\u4f86\uff0cDWR \u6c92\u8fa6\u6cd5\u63d0\u4f9b\u4f60\u9019\u6a23\u7684 URL\uff0c\u4ed6\u662f\u76f4\u63a5\u56de\u50b3 javascript \u7269\u4ef6\u7d66\u4f60\uff0c\u5e78\u597d datatables \u4e5f\u53ef\u4ee5\u62ff javascript \u7269\u4ef6\u8cc7\u6599\u4f86\u7528\u3002 \u9996\u5148 initialize datatable $(document).ready(function() { $(&#8216;#myTable&#8217;).dataTable( { aoColumns: [ {sTitle: &#8220;\u7528\u6236&#8221;}, {sTitle: &#8220;\u96fb\u8a71&#8221;} ] } ); } ); \u518d\u4f86\u628a callback \u6536\u5230\u7684\u8cc7\u6599\u585e\u9032 datatable \u5373\u53ef myDWRInterface.query( { callback: function(result) { var dt=$(&#8216;#myTable&#8217;).dataTable(); dt.fnClearTable(); [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[124,118],"class_list":["post-540","post","type-post","status-publish","format-standard","hentry","category-ajax","tag-dwr","tag-jquery"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/posts\/540","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=540"}],"version-history":[{"count":5,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/posts\/540\/revisions"}],"predecessor-version":[{"id":788,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=\/wp\/v2\/posts\/540\/revisions\/788"}],"wp:attachment":[{"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=540"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=540"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.amjet.biz\/IT\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=540"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}