List view shows 0 or 1 instead of checkmark

Posted:
Wed Jul 21, 2010 12:15 pm
by transcan
When entering a new record, a checkmark prompt is properly displayed.
When in List view, a value of 0 or 1 appears whether it is checked or not when entering the record. How can a setting or delegate change the 0 or 1 to supposed show No or Yes for example?
Also, when in view mode within detail mode, the field does not appear whatsoever. How can this be made to show the field and thus No or Yes as well?
Thanks in advance.
Re: List view shows 0 or 1 instead of checkmark

Posted:
Wed Jul 21, 2010 2:24 pm
by olivyeah
Hi transcan
For list view you can have a delegate class like that:
- Code: Select all
function field__rendercell(&$record){
if ( $record->val('field') == '1' ){
return '<B>YES</B>';
}
else return 'NO';
}
where 'field' is your check-box field name.
regards
Re: List view shows 0 or 1 instead of checkmark

Posted:
Wed Jul 21, 2010 4:44 pm
by shannah
Overriding renderCell() will only affect the appearance in the list view. If you want to override the appearance everywhere you could override the display() method.
i.e.:
- Code: Select all
function fieldname__display(&$record){
if ( $record->val('fieldname') ) return 'Yes';
else return 'No';
}
Alternatively you could achieve what you want by implementing a valuelist and applying it to the field using the vocabulary directive.
e.g.
in the delegate class:
- Code: Select all
function valuelist__yesno(){
return array(0=> 'No', 1=>'Yes');
}
and in the fields.ini file:
- Code: Select all
[fieldname]
vocabulary=yesno
Re: List view shows 0 or 1 instead of checkmark

Posted:
Thu Jul 22, 2010 7:51 am
by transcan
I could not test your solution. This thread is somewhat related to another:
http://xataface.com/forum/viewtopic.php?f=4&t=5461&start=0Since I used a workaround, making yes or no appear became moot.
Thanks again.