{"id":897,"date":"2016-09-14T13:53:45","date_gmt":"2016-09-14T11:53:45","guid":{"rendered":"http:\/\/dokumentacja.edokumenty.eu\/?page_id=897"},"modified":"2017-09-13T22:44:03","modified_gmt":"2017-09-13T20:44:03","slug":"dbtable","status":"publish","type":"page","link":"http:\/\/developer.edokumenty.eu\/index.php\/dokumentacja-online-systemu-edokumenty\/ui-elements\/listy-dbtable-simpletable\/dbtable\/","title":{"rendered":"DBTable"},"content":{"rendered":"<p>Je\u015bli chcemy zaprezentowa\u0107 dane pochodz\u0105ce z bazy danych w formie tabeli mo\u017cna do tego celu u\u017cy\u0107 obiektu DbTable<\/p>\n<p><a href=\"http:\/\/developer.edokumenty.eu\/wp-content\/uploads\/2016\/09\/SHU_BXGvMW.png\"><img loading=\"lazy\" class=\"alignnone wp-image-3686 size-full\" src=\"http:\/\/developer.edokumenty.eu\/wp-content\/uploads\/2016\/09\/SHU_BXGvMW.png\" alt=\"\" width=\"713\" height=\"310\" srcset=\"http:\/\/developer.edokumenty.eu\/wp-content\/uploads\/2016\/09\/SHU_BXGvMW.png 713w, http:\/\/developer.edokumenty.eu\/wp-content\/uploads\/2016\/09\/SHU_BXGvMW-300x130.png 300w\" sizes=\"(max-width: 713px) 100vw, 713px\" \/><\/a><\/p>\n<p>Poni\u017cszy fragment kodu dodaje ten obiekt do dialogu<\/p>\n<div class=\"code-highlight code-highlight-with-label\" data-label=\"PHP\"><span class=\"js-copy-to-clipboard copy-code\">copy<\/span>\n\t<pre><code class=\"language-php js-code\">\nrequire_once(LIB_PATH.'dbviews\/DBTable.inc');\r\n\r\n$this-&gt;list\u00a0=\u00a0new\u00a0DBTable($this-&gt;name.'list');\r\n$this-&gt;list-&gt;position\u00a0=\u00a0'absolute';\r\n$this-&gt;list-&gt;width\u00a0=\u00a0'100%';\r\n$this-&gt;list-&gt;top\u00a0=\u00a0'48px';\r\n$this-&gt;list-&gt;height\u00a0=\u00a0'calc(100%\u00a0-\u00a048px)';\r\n$this-&gt;list-&gt;left\u00a0=\u00a0'0px';\r\n$this-&gt;list-&gt;overflow\u00a0=\u00a0'auto';\r\n$this-&gt;list-&gt;setLimit(0);\r\n$this-&gt;list-&gt;setMaxFilling(NULL);\r\n$this-&gt;list-&gt;style\u00a0=\u00a0'border:none;\u00a0border-top:1px\u00a0solid\u00a0#bbb;';\r\n$this-&gt;list-&gt;tableName\u00a0=\u00a0'documents';\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/Nazwa\u00a0tabeli\u00a0z\u00a0kt\u00f3rej\u00a0maj\u0105\u00a0by\u0107\u00a0pobrane\u00a0dane\r\n$this-&gt;list-&gt;pkeyName\u00a0=\u00a0'doc_id';\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/klucz\u00a0\u00a0g\u0142\u00f3wny\r\n$this-&gt;list-&gt;order\u00a0=\u00a0array('doc_id'\u00a0=&gt;\u00a0'ASC');          \/\/domy\u015blne\u00a0sortowanie\r\n$this-&gt;list-&gt;clsnam\u00a0=\u00a0'DOCUMENT';\r\n$this-&gt;list-&gt;create('is_del\u00a0is\u00a0FALSE');                 \/\/domy\u015blne ograniczenia\r\n$this-&gt;list-&gt;ondblClick\u00a0=\u00a0'alert(obj.id);\u00a0return\u00a0false;'; \/\/funkcja JavaScript'owa, kt\u00f3ra wykona si\u0119 po dwukrotnym klikni\u0119ciu\r\n\r\n\r\n$this-&gt;add($this-&gt;list);\r\n\r\n\/\/formatowanie kolumn\r\n$this-&gt;list-&gt;format\u00a0=\u00a0array(\r\n    'doc_id'\u00a0=&gt;\u00a0array(\r\n\t'caption'\u00a0=&gt;\u00a0'ID',\r\n\t'visible'\u00a0=&gt;\u00a0TRUE,\r\n\t'sort'\u00a0=&gt;\u00a0TRUE,\r\n\t'style'\u00a0=&gt;\u00a0'width:30px;\u00a0text-align:right;',\r\n    ),\r\n    'dscrpt'\u00a0=&gt;\u00a0array(\r\n\t'caption'\u00a0=&gt;\u00a0Translator::translate('Nazwa'),\r\n\t'visible'\u00a0=&gt;\u00a0TRUE,\r\n\t'sort'\u00a0=&gt;\u00a0TRUE,\r\n\t'tooltip'\u00a0=&gt;\u00a0'extended',\r\n\t'style'\u00a0=&gt;\u00a0'',\r\n    ),\r\n    'adddat'\u00a0=&gt;\u00a0array(\r\n\t'caption'\u00a0=&gt;\u00a0Translator::translate('Data'),\r\n\t'visible'\u00a0=&gt;\u00a0TRUE,\r\n\t'sort'\u00a0=&gt;\u00a0true,\r\n\t'edit'\u00a0=&gt;\u00a0TRUE,\u00a0\r\n    ),\r\n);\n<\/code><\/pre><\/div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Je\u015bli chcemy zaprezentowa\u0107 dane pochodz\u0105ce z bazy danych w formie tabeli mo\u017cna do tego celu u\u017cy\u0107 obiektu DbTable Poni\u017cszy fragment kodu dodaje ten obiekt do dialogu &nbsp; &nbsp;<\/p>\n","protected":false},"author":3,"featured_media":0,"parent":489,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"tags":[25],"_links":{"self":[{"href":"http:\/\/developer.edokumenty.eu\/index.php\/wp-json\/wp\/v2\/pages\/897"}],"collection":[{"href":"http:\/\/developer.edokumenty.eu\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/developer.edokumenty.eu\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/developer.edokumenty.eu\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/developer.edokumenty.eu\/index.php\/wp-json\/wp\/v2\/comments?post=897"}],"version-history":[{"count":6,"href":"http:\/\/developer.edokumenty.eu\/index.php\/wp-json\/wp\/v2\/pages\/897\/revisions"}],"predecessor-version":[{"id":3688,"href":"http:\/\/developer.edokumenty.eu\/index.php\/wp-json\/wp\/v2\/pages\/897\/revisions\/3688"}],"up":[{"embeddable":true,"href":"http:\/\/developer.edokumenty.eu\/index.php\/wp-json\/wp\/v2\/pages\/489"}],"wp:attachment":[{"href":"http:\/\/developer.edokumenty.eu\/index.php\/wp-json\/wp\/v2\/media?parent=897"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/developer.edokumenty.eu\/index.php\/wp-json\/wp\/v2\/tags?post=897"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}