From 10253e06997c9875f3d793bdd32b4b53d9f69868 Mon Sep 17 00:00:00 2001 From: abrudz Date: Mon, 19 Sep 2016 11:42:37 +0100 Subject: [PATCH] DataTable samples rename, move, update. --- .../DC/DatatablesAdvanced_CFW1.mipage | 37 --------------- .../MS3/Examples/Data/TeamDyalog.csv | 47 +++++++++---------- .../MS3/Examples/JS/DataTableAdvanced.mipage | 31 ++++++++++++ .../{DC => JS}/DataTableSimple.mipage | 10 +--- 4 files changed, 56 insertions(+), 69 deletions(-) delete mode 100644 SampleMiSites/MS3/Examples/DC/DatatablesAdvanced_CFW1.mipage create mode 100644 SampleMiSites/MS3/Examples/JS/DataTableAdvanced.mipage rename SampleMiSites/MS3/Examples/{DC => JS}/DataTableSimple.mipage (59%) diff --git a/SampleMiSites/MS3/Examples/DC/DatatablesAdvanced_CFW1.mipage b/SampleMiSites/MS3/Examples/DC/DatatablesAdvanced_CFW1.mipage deleted file mode 100644 index 35189dab..00000000 --- a/SampleMiSites/MS3/Examples/DC/DatatablesAdvanced_CFW1.mipage +++ /dev/null @@ -1,37 +0,0 @@ -:Class DatatablesAdvanced_CFW1 : MiPageSample -⍝ Control:: _JS.DataTable -⍝ Description:: Feature-rich Datatable with plugins like "ColumnFilterWidget" - - :field private Datafile←'TeamDyalog.csv' - - ∇ Compose;button;frm;dyalog;dPath;dat - :Access Public - - Add _.h2'Datatables with plugins...' - Add _.p ScriptFollows -⍝ In this example we're using the 'SearchHighlight'-Plugin to highlight seach-results (try it yourself!) -⍝ and the "ColumnFilterWidgets"-Plugin ("CFW") which enables selection of filter-criteria through list-box of unique values. -⍝ So, in addition to all features of the standard Datatables, pay attention to: -⍝ - - dPath←_Request.Server.Config.AppRoot,'examples/data/' - :If 0=⎕NC'#.LoadData' - dyalog←2 ⎕NQ'.' 'GetEnvironment' 'dyalog' - #.⎕CY dyalog,'/ws/loaddata' ⍝ must be copied to root because of absolute reference #.fileUtilities - :EndIf - - dat←#.LoadTEXT(dPath,Datafile)';' ⍝ get Data from CSV - dt←'#sample'Add _.DataTable dat '' 1 '' 0 0 ⍝ add table to the page with that data - dt.Options.dom←'Wfrtip' ⍝ with "W"-Option for the CFW-Widget - dt.Options.searchHighlight←7161⌶1 ⍝ Brian: should't #.JSON.true be useable in such cases? It is not. Is there another tool for that? - - ∇ - -:EndClass diff --git a/SampleMiSites/MS3/Examples/Data/TeamDyalog.csv b/SampleMiSites/MS3/Examples/Data/TeamDyalog.csv index 081af85a..f37d0298 100644 --- a/SampleMiSites/MS3/Examples/Data/TeamDyalog.csv +++ b/SampleMiSites/MS3/Examples/Data/TeamDyalog.csv @@ -1,24 +1,23 @@ -Name;Based in;Joined;Title -Gitte;DK;2005/04;Managing Director / CEO -Morten;DK;2005/04;Evangelist / CXO -Adm;CA;2015/05;Developer -Andy;UK;1987/07;Operations Manager / COO -Bjrn;DK;2005/04;Developer -Brian;USA;2011/03;APL Tools Group Manager -Dan;CA;2006/01;Tester, teacher, writer -Fiona;UK;2013/04;Documentation Manager -Geoff;UK;1977/01;Radical -Helene;DK;2005/04;Finance Manager (CFO) -Jason;UK;2007/05;IT Manager -Jay;UK;2010/04;Technical Director / CTO -JohnD;UK;1991/09;Chief Architect -JohnS;UK;1981/07;Founder & Old hand -Karen;UK;1992/05;Customer Account Manager -Nadine;DK;2014/05;Communication -Nic;F;2006/08;Developer -Nick;UK;2014/01;Developer -Pete;GR;1977/09;Founder & Bouzuki-Player -Richard;UK;2008/06;Development Manager -Roger;CA;2011/01;Aesthetic Thinking -Vibeke;UK;2006/02;PR & Marketing Guru -Vince;UK;1996/06;Support +Name,Based in,Month,Year +Gitte,Denmark,April,2005 +Morten,Denmark,April,2005 +Adm,United Kingdom,May,2015 +Andy,United Kingdom,July,1987 +Bjrn,Denmark,April,2005 +Brian,USA,March,2011 +Dan,Canada,January,2006 +Fiona,United Kingdom,April,2013 +Geoff,United Kingdom,January,1977 +Helene,Denmark,April,2005 +Jason,United Kingdom,May,2007 +Jay,United Kingdom,April,2010 +JohnD,United Kingdom,September,1991 +JohnS,United Kingdom,July,1981 +Karen,United Kingdom,May,1992 +Nic,France,August,2006 +Nick,United Kingdom,January,2014 +Pete,Greece,September,1977 +Richard,United Kingdom,June,2008 +Roger,Canada,January,2011 +Vibeke,United Kingdom,February,2006 +Vince,United Kingdom,June,1996 diff --git a/SampleMiSites/MS3/Examples/JS/DataTableAdvanced.mipage b/SampleMiSites/MS3/Examples/JS/DataTableAdvanced.mipage new file mode 100644 index 00000000..a8b2f518 --- /dev/null +++ b/SampleMiSites/MS3/Examples/JS/DataTableAdvanced.mipage @@ -0,0 +1,31 @@ +:Class DataTableAdvanced : MiPageSample +⍝ Control:: _JS.DataTable +⍝ Description:: DataTable with options plus "ColumnFilterWidget" and "SearchHighlight" plug-ins + + :field private Datafile←'TeamDyalog.csv' + + ∇ Compose;dyalog;dPath;dat;dt + :Access Public + + Add MarkdownFollows +⍝ In this example we are using two plug-ins to enhance our DataTable: +⍝ +⍝ - **SearchHighlight** highlights the searched-for phrase in each result (try typing *mar* into the search box) +⍝ - **ColumnFilterWidgets** adds dropdown list-boxes for selection of filtering criteria. You can remove any item by clicking on it. +⍝ - Note how the **dom** option is used to hide the page switching buttons -- only +⍝ one page of data (limited to the default of 10 records) is shown + + dPath←_Request.Server.Config.AppRoot,'examples/data/' + :If 0=⎕NC'#.LoadData' + dyalog←2 ⎕NQ'.' 'GetEnvironment' 'dyalog' + #.⎕CY dyalog,'/ws/loaddata' ⍝ must be copied to root because of absolute reference #.fileUtilities + :EndIf + + dat←#.LoadTEXT dPath,Datafile ⍝ get Data from CSV + dt←'#sample'Add _.DataTable dat'' 1 '' 0 0 ⍝ add table to the page with that data + dt.Options.dom←'Wfrtip' ⍝ with "W"-Option for the CFW-Widget + dt.Options.searchHighlight←_true ⍝ Brian: should't #.JSON.true be useable in such cases? It is not. Is there another tool for that? + + ∇ + +:EndClass diff --git a/SampleMiSites/MS3/Examples/DC/DataTableSimple.mipage b/SampleMiSites/MS3/Examples/JS/DataTableSimple.mipage similarity index 59% rename from SampleMiSites/MS3/Examples/DC/DataTableSimple.mipage rename to SampleMiSites/MS3/Examples/JS/DataTableSimple.mipage index e5d0b47b..bfd2a09c 100644 --- a/SampleMiSites/MS3/Examples/DC/DataTableSimple.mipage +++ b/SampleMiSites/MS3/Examples/JS/DataTableSimple.mipage @@ -5,14 +5,9 @@ ∇ Compose;data;dt :Access Public - Add _.h2'DataTable' - Add _.p ScriptFollows -⍝ The DataTable widget uses the JS-Library DataTables -⍝ which provides a very powerful and comprehensive rendering tool for tabular data. - Add _.h2'Health Care Spending by Country' - Add _.p ScriptFollows -⍝ Data on this page was taken from the CIA World Factbook. + Add MarkdownFollows +⍝ Data on this page was taken from the [CIA World Factbook](https://www.cia.gov/library/publications/the-world-factbook/rankorder/2225rank.html). ⍝ [;1] country [;2] % GDP [;3] population [;4] GDP [;5] $/capita data←1 #.Files.FREAD #.Boot.AppRoot,'Examples/Data/stats.DCF' @@ -23,4 +18,3 @@ ∇ :EndClass - \ No newline at end of file