Link | results_table |
Author | Jason Huck |
Category | Results |
Version | 8.x |
License | Public Domain |
Posted | 30 Jan 2006 |
Updated | 20 Nov 2007 |
More by this author... |
This tag is primarily designed to create quick'n'dirty results tables from within an inline, though it will work with any properly formatted data set you provide. It supports sortable columns, hidden fields, and alternating row and header styles. You can also replace the contents of any column with the result of a compound expression or tag reference. Requires [client_params]. Can be used in concert with [results_navigation] and [results_status] to put together a basic results page fairly quickly.
var('procs') = map( 'tag_name' = { local( 'row' = params->first, 'cell' = params->second ); return('' + #cell + ''); } ); var('sortCol') = (action_param('sortfield') ? action_param('sortfield') | 'ID'); var('sortDir') = (action_param('sortorder') ? action_param('sortorder') | 'ascending'); inline( -search, -username='xxxxxx', -password='xxxxxx', -database='LDML8_Reference', -table='tags', -returnfield='ID', -returnfield='tag_id', -returnfield='tag_name', -returnfield='tag_category', -sortfield=$sortCol, -sortorder=$sortDir, -skiprows=skiprecords_value, -maxrows=20 ); results_status; results_table( -procs=$procs, -hidden=array('tag_id') ); results_navigation; /inline;
Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
define_tag( 'table', -namespace='results_', -priority='replace', -optional='headers', -type='array', -optional='data', -type='array', -optional='hidden', -type='array', -optional='procs', -type='map', -optional='sortable', -type='boolean', -description='Generates a basic HTML results table for inlines.' ); // set defaults !local_defined('headers') ? local('headers') = field_names; !local_defined('data') ? local('data') = rows_array; !local_defined('hidden') ? local('hidden' = array); !local_defined('sortable') ? local('sortable' = true); !local_defined('procs') ? local('procs' = map); local('out' = '\
' + #j->replace('_',' ')& + ' | \n'; /iterate; #out += '\t\t
---|
'; local('proc') = #procs->find(#headers->get(loop_count)); #out += (#proc->isa('tag') ? #proc->run( -params=array(#i,#j)) | #j); #out += ' | \n'; /if; /iterate; #out += '\t\t
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft
Re: Use other headers then field names?