{"id":1658,"date":"2017-07-11T11:07:24","date_gmt":"2017-07-11T16:07:24","guid":{"rendered":"https:\/\/xlinesoft.com\/blog\/?p=1658"},"modified":"2017-07-11T11:11:41","modified_gmt":"2017-07-11T16:11:41","slug":"creating-grid-tabs-dynamically","status":"publish","type":"post","link":"https:\/\/xlinesoft.com\/blog\/2017\/07\/11\/creating-grid-tabs-dynamically\/","title":{"rendered":"Creating Grid Tabs dynamically"},"content":{"rendered":"<p>Version 9.8 added an option to use Grid Tabs. Besides static tabs we also developed an API that allows to create and manage tabs from your code. <\/p>\n<p>In this example we will use the typical Orders table to demonstrate how this API works. We will create a tab for each employee that lists her own orders only. This is how it is going to look in generated application. <\/p>\n<p><a href=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2017\/07\/orders_tabs.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2017\/07\/orders_tabs-300x115.png\" alt=\"\" title=\"orders_tabs\" width=\"300\" height=\"115\" class=\"alignnone size-medium wp-image-1662\" srcset=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2017\/07\/orders_tabs-300x115.png 300w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2017\/07\/orders_tabs-1024x395.png 1024w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2017\/07\/orders_tabs-150x57.png 150w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2017\/07\/orders_tabs-400x154.png 400w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2017\/07\/orders_tabs.png 1153w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\n<!--more--><br \/>\nThis code needs to be added to List page: BeforeProcess event.<\/p>\n<p>PHP<\/p>\n<pre name=\"code\" class=\"php:nocontrols\">\r\n$sql = \"select * from employees\";\r\n$rs = CustomQuery($sql);\r\nwhile ($data = db_fetch_array($rs)) {\r\n\r\n\t$pageObject->addTab(\"EmployeeID='\".$data[\"EmployeeID\"].\"'\", \r\n\t\t\t$data[\"FirstName\"], $data[\"EmployeeID\"]);\r\n}\r\n<\/pre>\n<p>C#<\/p>\n<pre name=\"code\" class=\"csharp:nocontrols\">\r\nstring sql = \"select * from employees\";\r\nXVar rs = tDAL.CustomQuery(sql);\r\nXVar data;\r\nwhile (data = CommonFunctions.db_fetch_array(rs)) {\r\n\tpageObject.addTab(\"EmployeeID='\"+data[\"EmployeeID\"].ToString()+\"'\",\r\n\t\tdata[\"FirstName\"], data[\"EmployeeID\"].ToString());\r\n}\r\n\r\n<\/pre>\n<p>ASP<\/p>\n<pre name=\"code\" class=\"vb:nocontrols\">\r\nsql = \"select * from employees\"\r\nset rs = CustomQuery(sql)\r\ndo while bValue(DoAssignment(data,db_fetch_array(rs)))\r\n   pageObject.addTab \"EmployeeID='\" & data(\"EmployeeID\") & \"'\", _ \r\n\t\t\tdata(\"FirstName\"), data(\"EmployeeID\")\r\nloop\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Version 9.8 added an option to use Grid Tabs. Besides static tabs we also developed an API that allows to create and manage tabs from your code. In this example we will use the typical Orders table to demonstrate how this API works. We will create a tab for each employee that lists her own orders only. This is how it is going to look in generated application.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,10,1,8],"tags":[],"class_list":["post-1658","post","type-post","status-publish","format-standard","hentry","category-asp-net","category-news","category-php-category","category-tutorials"],"_links":{"self":[{"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/posts\/1658","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/comments?post=1658"}],"version-history":[{"count":5,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/posts\/1658\/revisions"}],"predecessor-version":[{"id":1665,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/posts\/1658\/revisions\/1665"}],"wp:attachment":[{"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/media?parent=1658"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/categories?post=1658"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/tags?post=1658"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}