There is one required argument and many optional arguments
to @gtable(())
| Name |
Value |
Required? |
Dynamic? |
| key |
key value |
yes |
no |
| sheet |
sheet name |
no |
no |
| search |
search term determines what results to
return based on search |
no |
yes |
| header |
true or false |
no |
no |
| theme |
theme name or use ‘native’ to get native
formatting (see here for list of
themes) |
no |
no |
| id |
id Provides a custom ID for the resulting
table |
no(but recommended) |
no |
| html |
semicolon (;) seperated list of columns to
treat as having embedded HTML |
no |
yes |
| ignore |
semicolon (;) seperated list of colulmns to not
show in table |
no |
yes |
| sortby |
column name to sort |
no |
yes |
| autofilter |
true or false enable ‘autofilter’
option with javascript driven drop down tables |
no |
no |
| reverse |
true or false Determines sort
order |
no |
no |
While the actual values passed depend on the argument the
syntax is always the same. You put the argument, a colon
(:) and then the value. Arguments are seperated by commas
(,) and if a argument takes multiple values (such as the
ignore argument) you multiple values by semicolons (;)
Dynamic Syntax
Some arguments support 'dynamic' syntax. This means that
you can either specify the value when you are typing in
RapidWeaver
or you can specify a 'default'
value but allow it to be overwritten when the user actually
views the HTML page.
The syntax for dynamic syntax is
%
default value |
variable %
The 'variable' comes from session variables
which are usually set via either forms or from the URL
using the
?variable=value syntax.
key
Synopsis:
key:key value
The 'key' is the only required argument. Think of it as the
unique name of your spreadsheet. In order for the key to
work you also need to make sure you 'publish' it (otherwise
it will be private and will not be viewable on your web
page)
The key is easily identifiable in the google URL to the
spreadsheet (it's the numbers and letters after the 'key='
While you are here make sure that you have actually set up
the spreadsheet to be published. you may also want to
select 'Automatically re-publish after changes' so you
don't have a to manually republish each time (this is a
personal preference of course)
An example of using the
'key' argument (using my phone comparison sample
spreadsheet) is:
@gtable((key:pegfyTc8f6LYQpwkWvmq-Dg))
sheet
Synopsis:
sheet:sheet name
The sheet is the name of the sheet, in this case 'Joe',
that you want to use. If not specified the first sheet will
be used.
An example of using the
'sheet' argument (using my phone comparison sample
spreadsheet) is:
@gtable((key:pegfyTc8f6LYQpwkWvmq-Dg,sheet:Joe))
search
Synopsis:
search:search criteria
The 'search' argument is the most powerful and versitile
argument in gtable. With it you can only display data that
meets certain criteria. Search criteria looks like a math
expression such as Cost < 400 or (Cost < 400) and
(Memory >2).
The exact syntax is
[columnName][binaryOperator][value]
- Supported
binaryOperators
are:
() for overriding order of operations
= or == for strict equality
<> or != for strict inequality
and or && for boolean and
or or || for boolean or
> for greater than
< for less than
When using the parenthesis () please make sure to put at
least one space between muliple paris e.g.
( (Price
< 3) and (Weight>3) ) The reason for this is
that gtable looks for the double closing parenthesis to
decide the end of the command and will get confused if
there is not a space.
header
Synopsis:
header:true or false
The header argument specifies whether the 'header' row
should be displayed or not, valid values are 'true' or
'false'. The header row is defined as the first non empty
row in the spreadsheet and it's extremely important in
gtable since it also is how you specify search criteria,
html columns and ignore columns.
An example of using this is
@gtable((key:pegfyTc8f6LYQpwkWvmq-Dg,header:true))
theme
Synopsis:
theme:theme name
The 'theme' argument allows you to easily use one of the
built in themes to style your table.
See here for a list of
currently available themes.
@gtable((key:pegfyTc8f6LYQpwkWvmq-Dg,theme:golden-style))
See also 'id' below.
id
Synopsis:
id:unique id
The 'id' argument lets you specify a unique id for the html
table. Highly recommended if you use one of the built in
themes.
@gtable((key:pegfyTc8f6LYQpwkWvmq-Dg,theme:golden-style,id:list-of-phones))
html
Synopsis:
html:Column Name(s)
The 'html' argument allows you to specify what columns
contain HTML data. In the case of a spreadsheet you need to
manually insert the HTML. This argument can take multple
values (columns) by separating them with semicolons (;)
When specifying a comment please use it exactly as it
appears in the spreadsheet. Also please refrain from using
colons(:), semicolons (;) and commas (,) in the column
title.
An example of using this with a single value is:
@gtable((key:pegfyTc8f6LYQpwkWvmq-Dg,html:Name))
An example of using this with multiple values is::
@gtable((key:pegfyTc8f6LYQpwkWvmq-Dg,html:Name;Description
Comments))
ignore
Synopsis:
ignore:Column Name(s)
The 'ignore' argument allows you to specify what columns
you should 'ignore' (e.g. don't show). This is usfeul if
your data contains columns that you don't want displayed on
the web page. It's syntax is identical to html above This
argument can take multple values (columns) by separating
them with semicolons (;)
When specifying a comment please use it exactly as it
appears in the spreadsheet. Also please refrain from using
colons(:), semicolons (;) and commas (,) in the column
title.
An example of using this with a single value is:
@gtable((key:pegfyTc8f6LYQpwkWvmq-Dg,ignore:Availability))
An example of using this with a single value is:
@gtable((key:pegfyTc8f6LYQpwkWvmq-Dg,gnore:Availability;Cost))
sortby
Synopsis:
sortby:Column Name
The 'sortby' argument allows you to specify how you want
the data sorted. By default the data appears as it is in
the spreadsheet but with the 'sortby' argument you can
specify some different sort order. For instance you may
have a column of 'price' and 'On Hand Quatity'. You could
display the same data in two different tables by specifying
sortby.
When specifying a comment please use it exactly as it
appears in the spreadsheet. Also please refrain from using
colons(:), semicolons (;) and commas (,) in the column
title.
An example of using this is:
@gtable((key:pegfyTc8f6LYQpwkWvmq-Dg,html:sortby:Cost))
@gtable((key:pegfyTc8f6LYQpwkWvmq-Dg,html:sortby:Memory))
reverse
Synopsis:
reverse:true or false
The 'reverse' argument works with 'sortby' to specify if
you should sort in ascending or descending order.
An example of using this is:
@gtable((key:pegfyTc8f6LYQpwkWvmq-Dg,sortby:Cost,reverse:true))
@gtable((key:pegfyTc8f6LYQpwkWvmq-Dg,sortby:Memory))