I am beginning to work with jquery, javascript and ajax directly as I work 
through tutorials.

I want a grid listing journals with a button for each row which, when 
clicked, will open a modal window with another grid (or sqltable) in it 
containing a list of articles 
published in that journal.

Looking at the MModal plugin 
(http://www.web2py.com/plugins/default/mmodal)  I am not clear on how to 
define a link in the controller for the button in the grid that will open 
the modal window.

I have two functions in a module that I want to use:


def artikels(query = db.akb_articles.id > 0):
    links = [lambda row: A(B('View'), _target = "_blank",
                           _href = URL(r = request, c = 'default',
                                       f = 'show_akb_article',
                                       args = str(row[db.akb_articles.id
])))]
    
    form = SQLFORM.grid(query,
                        fields = fields,
                        orderby = db.akb_articles.title,
                        maxtextlength = 80,
                        editable = False, deletable = False,
                        details = False,
                        links = links,
                        ui = 'jquery-ui')
    
    return form
    
def joernaalartikels(juuid):
    query = db.akb_articles.journal == juuid
    am = PluginMModal(title = T('Articles '), content= artikels(juuid),
                      close = T('Close'), width=100, height=70)
    return am

My partial definition for 'links' for the first grid (journals) which I 
don't know how to complete:

links = [lambda row: A('Edit' , _href = URL('default', 'edit_journal',
                                                        args = [row.id])),
             lambda row: A('Show articles', _href = ('default', ????????]

According the slice the link should be something like

am.link('click to see related articles')


How do Implement that  (call joernaal_artikels) and pass the result to a 
modal window using SQLFORM.grid's 'links'?

Regards
Johann


Reply via email to