I'm creating a dict 'rows' from the controller that uses the view which has 
FullCalendar in it.

Here is the controller:
@auth.requires_login()
def mycal():
    rows=db(db.work_order.tech==auth.user.id).select()
    return dict(rows=rows)


db.work_order has a 'tech' column, which i'm sure you can see... This field 
contains the ID number of the 'tech'. So when I return the dictionary, this 
becomes 'row.tech' and contains the id number. 

I've been trying to use this ID number to query another table that has the 
actual names of the techs. I've also been trying to set my tip as:
*
tip: '{{db.executesql('SELECT first_name, last_name FROM tech WHERE id = 
'row.tech';')}}',*

However, this gives me a syntax error at 'row.tech', so I'm not sure how 
else I can do it.. 

Hope this provides some more info.


On Tuesday, May 7, 2013 12:07:20 PM UTC-6, Anthony wrote:
>
> db(db.tech.id==row.tech).select(db.tech.first_name, db.tech.last_name)
>
> The above returns a Rows object. When you do {{=rows_object}} in a view, 
> it gets serialzied into HTML via SQLTABLE. If you want to extract the first 
> and last names from just a single row, then you'll have to do so explicitly.
>
> Anthony
>
>
> On Tuesday, May 7, 2013 1:11:32 PM UTC-4, Doug Girard wrote:
>>
>> Below is a snippet of my code, where I am using FullCalendar. This code 
>> is working, giving me a 'tooltip' when hovering over an event, but my tip:
>> *
>> =db(db.tech.id==row.tech).select(db.tech.first_name, db.tech.last_name)*
>>
>> Returns a full table like:
>>
>> <table><thread><td><th>tech.first_name</th><th>tech.last_name</th>.... on 
>> and on with the names it returns...
>>
>> Is there a different way to do my query or tell web2py not to make it 
>> into a table? I just want the data from the 2 columns.
>>
>>
>> Thanks!!
>>
>>  
>> $('#calendar').fullCalendar({
>>             editable: true,
>>
>>             events: [
>>             {{for i,row in enumerate(rows):}}{{if i!=0:}},{{pass}}
>>                 {
>>                * tip: 
>> '{{=db(db.tech.id==row.tech).select(db.tech.first_name, 
>> db.tech.last_name)}}',*
>>                     title: '{{=row.name}}',
>>                     allDay: false,
>>                     start: new Date('{{=row.work_date.
>> strftime('%B %d, %Y %H:%M:%S')}}'),
>>                     end: new Date('{{=row.work_date.strftime('%B %d, %Y 
>> %H:%M:%S')}}'),
>>                     url: '{{=URL('sites',args=row.id)}}'
>>                 }
>>             {{pass}}
>>             ],
>>             eventRender: function(event, element) {
>>                 element.attr('title', event.tip);
>>             }
>>         });
>>
>>
>> This code above is working for me but my tip:
>>
>> =db(db.tech.id==row.tech).select(db.tech.first_name, db.tech.last_name)
>>
>> Returns a full table like:
>>
>> <table><thread><td><th>tech.first_name</th><th>tech.last_name</th>.... on 
>> and on with the names it returns...
>>
>> is there a different way to do my query or tell web2py not to make it 
>> into a table?
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to