LOL! I looked at the datagrid code (in 0.9.6 - manager/includes/controls/datagrid.class.php) and I don’t see any evidence that there is either a Checkbox or Text field type. Here are the choices:
function formatColumnValue($row,$value,$type,&$align){
if(strpos($type,":")!==false) list($type,$type_format) = explode(":",$type,2);
switch (strtolower($type)) {
case "integer":
if($align=="") $align="right";
$value = number_format($value);
break;
case "float":
if($align=="") $align="right";
if(!$type_format) $type_format = 2;
$value = number_format($value,$type_format);
break;
case "currency":
if($align=="") $align="right";
if(!$type_format) $type_format = 2;
$value = "$".number_format($value,$type_format);
break;
case "date":
if($align=="") $align="right";
if(!is_numeric($value)) $value = strtotime($value);
if(!$type_format) $type_format = "%A %d, %B %Y";
$value = strftime($type_format,$value);
break;
case "template":
// replace [+value+] first
$value = str_replace("[+value+]",$value,$type_format);
// replace other [+fields+]
if(strpos($value,"[+")!==false) foreach($row as $k=>$v){
$value = str_replace("[+$k+]",$v,$value);
}
break;
}
I would be inclined to try putting in another case in that function:
case: ’MyBoolean’:
if ($value == ’0’ || $value == 0) {
$value = ’ ’;
}
break;
}
If you don’t want to hack the code, it looks like the template type is your best hope. I did find this example for a datagrid with only one column:
colTypes = "template:<input type='radio' name='id' value='[+id+]' />";
And here’s a more complex example with a checkbox:
colTypes="template:<input name='tag[]' type='checkbox' value='[+id+]'/><img src='media/images/icons/comment.gif' width='16' height='16' align='absmiddle' /></a>||".
"template:<a href='#' title='".$_lang["click_to_edit_title"]."' onclick='editTag([+id+])'>[+value+]</a><span style='display:none;'><script type=\"text/javascript\"> tagRows['[+id+]']=[\"[+name+]\",\"[+tag+]\",\"[+tagvalue+]\",\"[+http_equiv+]\"];</script>";
IIRC, the datagrid is going away in MODx Revolution so you might want to take another approach. I think I’d just have a custom snippet to read the CSV file with something like the following:
$file_array = file($file_name, FILE_SKIP_EMPTY_LINES);
foreach ($file_array as $line_number => $line)
{
$line = rtrim($line); // strip EOL characters
$field_array = explode(',',$line');
.$output .= '<span class = "field1">' . $field_array[0] . '</span>';
$field_array[1] = $field_array[1] == '0' ? ' ' : $field_array[1];
.$output .= '<span class = "field2">' . $field_array[1] . '</span>';
$field_array[2] = $field_array[2] == '0' ? ' ' : $field_array[2];
.$output .= '<span class = "field3">' . $field_array[2] . '</span>';
$field_array[3] = $field_array[3] == '0' ? ' ' : $field_array[3];
.$output .= '<span class = "field4">' . $field_array[3] . '</span>';
.$output .= '<br />';
}