December 24, 2024, Tuesday, 358

<tableedit>

De Cadedif

Using TableEdit

Basic usage

fig 1
Figure 1

TableEdit provides a somewhat more friendly way to edit simple tables in mediawiki. TableEdit tables show up in a page with their own Edit link, which calls this page. Users who have editing privileges can then add rows and columns, rename headings, and change the style of the headings row.

Adding a TableEdit table to a page

Step 1: Add a newTableEdit tag where you want the table

To add a new table that can be edited by TableEdit, there are three options:

  • Add an empty table. Put <newTableEdit/> in the text, where you want the table to appear
  • Add a table with defined headings (Figure 1) put:
    <newTableEdit>Column heading 1
    Column heading 2
    Column heading 3
    etc...</newTableEdit>
    You can edit the columns later if needed.
  • Use a predefined template. See Basic templates below


fig 2
Figure 2
Step 2: Save the page
An empty table with your headings appears when we save the page (Figure 2) Click on the Edit table link and use the table editor.
Step 3: Edit the table

fig 3
Figure 3
fig 4
Figure 4
fig 5
Figure 5
fig 6
Figure 6
fig 7
Figure 7

Example

  1. We create a table with some headings enclosed in newTableEdit tags
  2. Click on the Edit Table link to go to the Table Edit special page
  3. Click on Add Data to add a row (Figure 3)
    I don't know who the governor is...let's leave that for someone else to add.
  4. Save the new row in the edit page (Figure 4). Note that it has not been saved back to the wiki page yet
  5. Let's add a column and make the heading background light blue. Click on Edit Headings. Add a heading and name it.
    Then set the heading style.
  6. Save back to the editor again.
  7. Save back to the wiki
Some other things you can do with these tables:
  • Rotate them so the headings are on the left
  • Use templates inside tables, or as styles

Basic Table templates

fig 8
Figure 8

For table formats that you plan to use on more than one page, you can define a template. To add a table based on a template. Put: <newTableEdit>Template:TemplateName lt;/newTableEdit> The template should be a Template page in the wiki that has a list of headings, where each heading is on a separate line. These will not be editable in the Special page, but changing the template page will change the headings on all tables that use that template. The changes won't be apparent until someone tries to edit the table and save it back to the page.

Figure 8 shows a simple Template. To use this, you would put <newTableEdit>Template:TestBox lt;/newTableEdit> in your wiki page

Advanced templates

Using tags to specify more properties

Attributes for the table can be wrapped in XML-like tags.
  • <headings></headings> for headings. Headings can have additional attributes, which can be used to customize the user interface and link content of rows to external sources (see below)
  • <heading_style></heading_style> for heading style
  • <table_style></table_style> for table style
  • <type></type> for horizontal (default) or vertical (1) orientation

Programming the TableEdit interface

Heading lists can have additional markup to modify the behavior of the Table Editor. Anything after a || in the headings list is considered part of a list of additional parameters for that heading. Individual parameters are delimited by single |s. The first parameter after the heading text is a unique column_name for the heading (this allows you to use non-unique names for the actual display). If this is not present, the heading name is assumed to be usable as the column_name. These are used for lookup and calculation fields as described below.
  Syntax:
  Heading||column_name|rule
 
  rule syntax
    text                    to use input type=text instead of textarea
    select|1|2|etc          make a pulldown menu with choices 1, 2, etc
    lookup|sql|field        sql statement|name of field to return
                            sql statements use {{{column_name}}} in place of specific fields
		
   example: Aspect||aspect|lookup|SELECT namespace from go_archive.term WHERE go_id = '{{{1}}}' ORDER BY term_update DESC LIMIT 1|namespace
	
   currently available calcs
      split                 split|delimiter|x|y|z 
                            where x,y, and z are integers indicating which parts of the split to join into the result

      reqcomplete           reqcomplete|column_name|column_name|column_name...  
                            where column names are required fields.
                            returns "complete" or "required field needed"
Example

Figure 9 shows the kind of thing you can do with the programming interface

fig 9
Figure 9

  • Two of the fields are controlled by pulldown menus.
  • Aspect is looked up in an external database
  • GO term name is a combination of a lookup and some string manipulation.
  • Status is calculated based on whether there is content in other fields.


Here is the template code used to generate the editing interface shown above (the indented lines are actually all part of one line; I broke them up to make them easier to read):

Qualifier||qualifier|select| |NOT
GO ID||go_id|text
GO term name||go_term|lookupcalc|SELECT page_title from go_archive.term WHERE go_id = '{{{go_id}}}' ORDER BY term_update DESC LIMIT 1|page_title|split|_!_|1
Reference(s)||refs
Evidence Code||evidence|select
   | 
   |IC: Inferred by Curator
   |IDA: Inferred from Direct Assay
   |IEA: Inferred from Electronic Annotation
   |IEP: Inferred from Expression Pattern
   |IGC: Inferred from Genomic Context
   |IGI: Inferred from Genetic Interaction
   |IMP: Inferred from Mutant Phenotype
   |IPI: Inferred from Physical Interaction
   |ISS: Inferred from Sequence or Structural Similarity
   |NAS: Non-traceable Author Statement
   |ND: No biological Data available
   |RCA: inferred from Reviewed Computational Analysis
   |TAS: Traceable Author Statement
   |NR: Not Recorded
with/from||with|text
Aspect||aspect|lookup|SELECT namespace from go_archive.term WHERE go_id = '{{{go_id}}}' ORDER BY term_update DESC LIMIT 1|namespace
Notes
Status||status|calc|reqcomplete|go_id|refs|go_term|evidence

Additional Documentation

For Known issues, ToDos, discussion of TableEdit, and other documentation, see (http://www.mediawiki.org/wiki/Extension:TableEdit)