re:
http://modxcms.com/datagrid-widget.html (a usage example would be
really helpful here)
What type of file does it take for the widget to work? Does the paging work?
I call the widget using the following in the default values for the widget TV I created for this. It renders a mostly-empty grid, with only single-characters running down the first column and correct headings.
@FILE assets/files/board.csv
FWIW, I’m able to take a simple CSV file and parse it into a table per a snippet below, but the Datagrid fails...
Data (assets/files/board.csv):
DATE,EQ, FROM - ST, FROM CITY, TO CITY, TO ST
10/17/05,FDT,AL,MONTEVALLO,PIGGOTT,AR
10/20/05,FDT,AL,PINE APPLE ,PIGGOTT,AR
10/18/05,S/D ONLY,CA,SAN DIEGO,CORTEZ,CO
Snippet code that works:
if (file_exists($modx->config['base_path'].$CSVf))
{$csvlines = file($modx->config['base_path'].$CSVf); }
else return "Not found $modx->config['base_path'].$CSVf" ;
$csvout = '<table border=1 cellspacing=0 cellpadding=3>';
foreach ( $csvlines as $line )
{
$csv=explode(',',$line); $line='<tr><td>'.implode('</td><td>',$csv).'</td></tr>';
$csvout=$csvout.$line;
}
return $csvout.'</table>';