howto--wishlist

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

Postby maddin » Fri Aug 11, 2006 8:06 am

hello everybody
even though i am working since a couple of years as a web develloper i am not really familliar with sql.
to me it would be very helpful to have a beginners tutorial on how to display data from 2 different tables (related) in one list view. since my english is not very good , a steb by step guide would be appreciated.

i extended the FacultyOfWidgetry example with a status field in the program table.
but how to make this status show up in the course list view?
i read all 118 forum topics to find a solution , but maybe i am to stupid...or i have to improve my english.

if somebody knows how and also could explain it in easy words ...

thanks and cheers
martin
maddin
 
Posts: 58
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Fri Aug 11, 2006 10:18 am

Hi Martin,

Currently there is no easy way to display data from 2 tables in the list view. You can do this with a relationship in one of the relationship tabs though. If you need a more complex list view you can create a custom action and write your own SQL query and use a custom template. It is also possible to override the contents of the list tab in the delegate class as follows:

Code: Select all
class tables_Courses {

    function block__result_list(){
        echo '';
        $res = mysql_query('select c.*, p.status from Courses c left join Programs p on c.ProgramID=p.ProgramID');
        while ( $row = mysql_fetch_assoc($res) ){
            echo '';
        }
        echo '
'.$row['Name'].''.$row['status'].'
';
    }

}



This would cause the list tab to display a table with the course name and status (obtained from the programs table). Perhaps in the future I'll create some ini file directives to automate this process, but for now, this is the best way.

Hope this helps a little.

Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby maddin » Sat Aug 12, 2006 3:26 am

thanks Steve
your example for the delegate class works perfectly
unfortunately it also overrides the styles and the built in table logic (links etc.)
is it possible to extent the class instead of overriding it
if there is no easy way to do this , don't worry then i try to include my own styles
cheers and thanks
martin
maddin
 
Posts: 58
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Sat Aug 12, 2006 10:52 am

Currently I can't think of a way to extend it. I'll look at adding this functionality in a later version. I don't believe it would be difficult.

Best regards

Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 18 guests

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