customize view_tab_content

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

Re: customize view_tab_content

Postby shannah » Wed Jun 20, 2012 10:15 am

cookie720 wrote:Can someone please post their full function which displays related records in a tables' details tab?
I have tried some bits and pieces from the previous posts, and I am getting some results, but they are not exactly what I want.
I simply need to list basically the last related record from each related table, in my tables details view, in the same format.

I thought it would be nice and simple but I just cant seem to get anything to work. Xataface is a very diverse program and the learning curve is hard for me because I am a beginner in both PHP + MySQL too


Here is a function that builds a related section for a details view. I call this function from appropriate section_xxx() methods of the delegate class.
Code: Select all
function buildRelatedSection(Dataface_Record $record, $relationship){
       import('Dataface/RelatedList.php');
       $relatedList = new Dataface_RelatedList($record, $relationship);
      $relatedList->noLinks = true;
      $relatedList->hideActions = true;
      $content = $relatedList->toHtml();
       
       
       $rel = $record->table()->getRelationship($relationship);
       
       
       return array(
          'class'=>'main',
          'content'=>$content,
          'label'=>$rel->getLabel(),
          'order'=>10
       );
   
    }


Creating a section for the "ingredients" relationship:
Code: Select all
function section__ingredients($record){
       return $this->buildRelatedSection($record, 'Ingredientes');
    }


-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: customize view_tab_content

Postby cookie720 » Thu Jun 21, 2012 5:57 am

Interesting, that creates a section that looks just like the list view of a table. It even has the add related record button...which didnt work for me.
That might come in handy!
However, what I wanted is a section that looks like the default tables display of fields. The view/display that comes up when you click on the display tab of a table
cookie720
 
Posts: 69
Joined: Mon Jun 04, 2012 9:22 pm

Previous

Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 19 guests

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