I use this little javascript function

function load_in_modal(url, modal_id, options, modal_options) {
    if (typeof options === 'undefined') {
      /* Example Options.
       * {title: "Add Image"}
       */
      options = {};
    }
    if (typeof modal_options === 'undefined') {
      modal_options = {}
    }
    modal_options.show = true;

    /* Remember to set an id in your modal's body */
    $.web2py.component(url, $('#' + modal_id + ' .modal-body').attr('id'));

    $('#' + modal_id).modal(modal_options);
    if (typeof options.title !== undefined) {
        $('#' + modal_id + ' .modal-title').text(options.title);
    }
}


Usage in your case would be to remove the LOAD call and change the button 
to this:


<button type="button" class="btn btn-primary" onclick="load_in_modal(
'{{=URL('default', 'news.load')}}', 'news')">
    News
</button>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.

Reply via email to