JSTags: async-table tag

Description

This tag creates an asynchronous table. Such a table will be created with the data retrieved from a given url.

The tag can be configured in order to load the table contents once, update them, load them when an event occurs, ...

The tag does not restrict the format of the data retrieved from the given url whenever you provide the JavaScript function that inserts the content in the page.

Even though the function inserting the content in the page can be provided by the user, there is a default one that expects the data to be an XML file with the following structure:

<?xml version="1.0" standalone="yes"?>
<table>
        <header>
                <row>
                        <cell>Company</cell>
                        <cell>Dealers</cell>
                        <cell>Clients</cell>                    
                </row>
        </header>
        <body>
                <row>
                        <cell>First company</cell>
                        <cell>54</cell>
                        <cell>12350</cell>                      
                </row>  
                <row>
                        <cell>Second company</cell>
                        <cell>15</cell>
                        <cell>10999</cell>                      
                </row>          
        </body>
</table>        

Tag reference

Attribute name Description Default Required Valid values
shooterId Identifier of the element that will fire the transformation. window false CSS selector expressions (i.e. div#menubar, .button). You may check MochiKit for further information.
targetId Identifier of the element the result of the transformation will be inserted in. true
event Event name on which the transformation will be fired. onload true event name (i.e. onclick, onmouseover).
url Url the data will be retrieved from. true
tableClass CSS class to be used for the table. false
oddRowClass CSS class to be used for every odd row. false
frequency If this attribute is set, the content will be refreshed every frequency seconds.
decay If this attribute is set, the content will be refreshed every frequency seconds and, if the content retrieved is the same as the last time it was requested, it will be refreshed again after refresh + delay seconds instead of refresh. The time between every refresh will be increased in delay seconds until the content changes and it's value be reseted to refresh seconds again. false
nameValuePairs It contains a ',' separated object of pairs name:value.
These parameters will be added, with the value given here, to the XML request.
false i.e. {name1:'value1',name2:56}.
formNames If this attribute is set (',' separated array of values), all the parameters of each form named in the attribute value (identified by the name provided here) will be sent with every XML request. false i.e. ['name1'] would take all of the parameters included in the form identified by name1 and send them to the xmlUrl as paramName=paramValue pairs.
params If this attribute is set (',' separated array of names), the value of every parameter included in its value (identified by the its id provided here) will be sent with every XML request. false i.e. ['param1','param2'] would add param1 and param2 to the xmlUrl request as param1=param1Value and param2=param2Value.
function If this attribute is set, the function identified by its value will be used instead of the default one provided in order to perform any task on the response. Such a function will receive the same parameters as the default one. false
startIndex In a paginated table, first element to be retrieved. This parameter will be sent, as startIndex=value, to the request url so that the server returns only data starting in startIndex. false integer.
count In a paginated table, maximum number of elements to be retrieved. This parameter will be sent, as count=value, to the request url so that the server returns only count elements. false integer.

Note: all of the attributes accept runtime expressions.

The startIndex and count parameters are used when the table has to be paginated. In such cases, use the link tag in order to set up how the next and previous links will be displayed.

The execution of this tag fires two events that can be used for you to perform any action you may need when they are fired:

  • onRequestStart: event thrown when the data request starts.
  • onDomModified: event thrown after the data has been requested and the page updated with the new content.