Creating a ruleset from scratch - "Hello World" example

A table preset or template in Tabulizer's terminology is called ruleset because it is much more than visual styling. A ruleset contains a set of rules that can do much more, including:

  • Data calculations
  • Data formatting
  • Data/text replacements
  • Cell merging
  • Client-side table sorting
  • Client-side search filtering
  • Table pagination
  • Table splitting
  • Table to graph conversion

Each rule applies to a table element, that can be:

  • a table row(s)
  • a table column(s)
  • a table cell(s)
  • the whole table

Many rules can apply to the same element, so in some cases the order of execution is may be important. In any case, one or more rules are contained in a ruleset (i.e. set of rules), and one or more rulesets are contained in a ruleset archive. The ruleset archive is a collection of files that are zipped together in a single file, the archive file that has the *.zip extension.

If you use the online creation wizard at www.tabulizer.com or the online graph creation wizard the archive file is created automatically for you based on your preferences. In this example, we will not use the online wizards, but instead we will create the ruleset archive from scratch. The simplest case is when we have one ruleset archive that contains one ruleset that contains a one rule. Just for this example, this rule will add a search filter on top of the table.

Step 1

Let's start with the ruleset archive creation. In the back-end we go to the Tabulizer's panel and then we click on the New Archive button.

In the form that appears fill out the following required fields:

Archive Filename:  demo_1.xml  
Archive Title:  A demo archive  
Archive Name: demo_1   
Archive Style: demo_1.css

When ready press the Save & Close button.

Note:

The Archive Filename can be any valid xml filename, therefore it must have the xml extension. It is recommended to use only latin letters, digits the underscore and the period characters with no spaces in between. The Archive Title can be any short text description. The Archive Name is used internally and it needs to be unique (i.e. no two ruleset archives should share the same name). It is required to use only latin letters, digits the underscore and the period characters with no spaces in between. The Archive style is a CSS file, therefore it must have the css extension. The archive style is optional, but if specified it will reside in the /templates/tabulizer/css folder. It is recommended, even though not required to have a similar name with the companion archive filename.

Step 2

If everything went as expected, you can click on the archive's title or on the View link in the actions column to view the contents of the archive. Since we haven't create any ruleset so far that contents of the archive will be empty.

Click on the New Ruleset button to create a new one.

In the form that appears fill out the following required fields:

Ruleset Title:    Demo Ruleset 1
Ruleset Description:     A demo ruleset for demo 1
Ruleset Name:  demo_1_ruleset_1  
Ruleset Suffix:   demo_1_ruleset_1 

When ready press the Save & Close button.

Note:

The Ruleset Title can be any short text description but it's good to be unique so it's easier to select the ruleset from the dropdown select box (imagine two ruleset sharing the same title). The Ruleset Description is an optional field that acts as a memo for the ruleset. The Ruleset Name is used internally and it has similar functionality and constraints as the archive name. The Ruleset Suffix will be appended to the table class name, so it affects all CSS definitions.

Step 3

If everything is OK, we have created the ruleset and we are ready to add the rule. Click on the archive's title and then click on the ruleset's title. The ruleset contains no rules so far and the list with rules is empty. Click on the New Rule button to create a new one.

In this "hello world" demo example we want to add one rule that will add a search filter on the top of the table. Since this rule will apply to the whole table, we set the rule's element = table. Also, this rule will apply always (i.e. regardless of the table size and other criteria) so the range is set to "all", meaning "all the times". Finally, we check the Table/Search Fitler Enabled checkbox because we want the rule to have this property.

When ready press the Save & Close button.

The ruleset is ready and it will be available next time you invoke the Tabulizer editor button.