Lasso Soft Inc. > Home


AuthorJason Huck
LicensePublic Domain
Posted30 Jan 2006
Updated20 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.

Sample Usage

var('procs') = map(
	'tag_name' = { 
			'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');


Source Code

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.

		-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' = '\

\		');
		iterate(#headers, local('i'));
			local('j' = #i);
			local('sortcode') = (sort_fielditem == #j ? ' id="sortcolumn"') + ' onClick="setSort(\'' + #j + '\');"';
			#hidden !>> #i ? #out += '\t\t\t' + #j->replace('_',' ')& + '\n';
		#out += '\t\t\n';

		iterate(#data, local('i'));
			#out += '\t\t\n';
			iterate(#i, local('j'));
				if(#hidden !>> #headers->get(loop_count));
					#out += '\t\t\t\n';
			#out += '\t\t\n';
		#out += '\t\n
'; local('proc') = #procs->find(#headers->get(loop_count)); #out += (#proc->isa('tag') ? #proc->run( -params=array(#i,#j)) | #j); #out += '
\n'; // generate form to set sort order if(#sortable); local('form' = '\
\ '); iterate(client_params, local('this')); if(!#this->isa('pair')); #form += '\t\n'; else( (: 'sortfield', 'sortorder', '-skiprows') !>> #this->first); #form += '\t\n'; /if; /iterate; #form += '
\n'; #out += #form; /if; return(@#out); /define_tag;

Related Tags


12 May 2008, Asle Benoni

Re: Use other headers then field names?

I also use this with -sql inlines. Just a small example code snippet for where you put the alias would get me in the right direction :-)

08 May 2008, Jason Huck

Re: Use other headers then field names?

I'm sure this could be improved if I had the time, but I always use this with -sql inlines and simply define aliases for the column names right in the query. Works great, even with sorting.

08 May 2008, Asle Benoni

Use other headers then field names?

Hi, very nice tag that I use often to make quick results tables. Is there any way to show other headers then the field names? I.ex. the field is called "c_name" and "d_name" but I would like the header to show "Customer" and "Dealer". Some kind of map to check against? This would be a great feature :-)

20 Nov 2007, Jason Huck


Now handles single params correctly (i.e., -random vs. -random=true).

21 Jan 2007, Asle Benoni

Problems sorting if ('headers') are different from field names

If 'headers' are manually defined the sorting will not work. I.ex. the fieldname is "cust_name" and one wants to display "Customer". Sorting would try to sort by "Customer" which does not exist as a field in the table. I tried to define another array with field_names but did not really get it to work. Something different must run in the "iterate(#headers, local('i'));" part I think. Glad for a simple solution!

17 Mar 2006, Jason Huck

Bug Fix

Fixed an issue where the tag would error if -procs were not defined.

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home



©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft