List view shows 0 or 1 instead of checkmark

A place for users and developers of the Xataface to discuss and receive support.

List view shows 0 or 1 instead of checkmark

Postby transcan » Wed Jul 21, 2010 12:15 pm

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.
transcan
 
Posts: 13
Joined: Wed Jul 21, 2010 11:57 am

Re: List view shows 0 or 1 instead of checkmark

Postby olivyeah » Wed Jul 21, 2010 2:24 pm

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
olivyeah
 
Posts: 8
Joined: Mon May 17, 2010 1:58 pm

Re: List view shows 0 or 1 instead of checkmark

Postby shannah » Wed Jul 21, 2010 4:44 pm

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
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: List view shows 0 or 1 instead of checkmark

Postby transcan » Thu Jul 22, 2010 7:51 am

I could not test your solution. This thread is somewhat related to another:

http://xataface.com/forum/viewtopic.php?f=4&t=5461&start=0

Since I used a workaround, making yes or no appear became moot.

Thanks again.
transcan
 
Posts: 13
Joined: Wed Jul 21, 2010 11:57 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 27 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved