OK, I've got a simple app that shows the behavior:

controllers/demo.py


# coding: utf8
# try something like
def index(): 
    return dict(message="hello from demo.py")


def edit_loader():
    loader = LOAD(f='edit_form', ajax=True)#change to ajax=False and form 
is shown in dialog
    return dict(loader = loader)


def edit_form():
    form = SQLFORM.factory(
           Field('first_name', 'text'),
           Field('last_name', 'text')
                           )
    return dict(form = form)

views/demo/index.html

{{extend 'layout.html'}}


{{if 'message' in globals():}}
<h3>{{=message}}</h3>


<h4>{{=T('How did you get here?')}}</h4>
<ol>
  <li>{{=T('You are successfully running web2py')}</li>
</ol>
{{elif 'content' in globals():}}
{{=content}}
{{else:}}
{{=BEAUTIFY(response._vars)}}
{{pass}}


<a class="updateDialog" href="{{=URL(r=request, f='edit_loader')}}">open 
edit dialog</a>


<div id="edit_dialog" title="Edit record"></div>
<script type="text/javascript">
$(function() {
    $("#edit_dialog").dialog({
        width: 600,
        height: 355,
        modal: true,
        autoOpen: false
    });
    //opens the dialog whenever one of the edit icons is clicked
    $('a.updateDialog').on('click',  function(event) {
        event.preventDefault();
        //get url to load from the clicked link's href
        var url = $(this).attr('href');


        //tell jqueryUI to load the url & show it in the dialog
        $('#edit_dialog').load(url, function() {
            $('#edit_dialog').dialog('open');
        });


    });
});




</script>

views/demo/edit_loader.html


{{=loader}}

views/demo/edit_form.html
<h1>This is the default/edit_form.html template</h1>
{{=BEAUTIFY(response._vars)}}

Make sure you've got jQueryUI included somewhere in the page layout I just 
stuck it at the bottom of views/web2py_ajax.html
<script src=
"//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js" type=
"text/javascript"></script>
<link rel="stylesheet" href=
"//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" type=
"text/css" media="all" />


As far as the jGrowl part being displayed twice, it looks like changing my 
javascript ajax() call so that it does NOT include an ':eval' argument at 
the end fixed that.


On Tuesday, December 17, 2013 8:09:12 AM UTC-6, Anthony wrote:
>
> We probably need to see some code.
>
> On Tuesday, December 17, 2013 12:44:23 AM UTC-5, Brian M wrote:
>>
>> This would seem to be the same issue as 
>> https://groups.google.com/d/topic/web2py/kyEYmfQs6L0/discussion  but yet 
>> the solution offered there (make sure you've got the latest web2py.js) 
>> doesn't seem to be working for me. Oddly, I've got another form being 
>> loaded with LOAD(ajax=True) on the same page and that one works just fine.
>>
>> What I'm trying to do is have a datatable with "Edit" links next to each 
>> record. When the edit link is clicked on, a jQueryUI dialog is opened and 
>> the dialog is told to load the edit page for the chosen record which is 
>> done using javascript to build the appropriate URL for the chosen record 
>> and then a regular jquery .load() to fetch it into the dialog. The edit 
>> controller's view is then using web2py's LOAD() to insert the actual edit 
>> form with ajax=True so the edit form can be submitted without ever leaving 
>> the main page.  This was working perfectly in older web2py (v 2.4.x) but 
>> now when I try to finally upgrade to web2py v2.8.2 all I get within the 
>> dialog is "Loading..."  I've verified that my app has the latest 
>> static/js/web2py.js (and web2py_ajax.html, appadmin.py and appadmin.html) 
>> as outlined in the release/upgrade notes for v2.6.
>>
>> Anybody have ideas about what might be going wrong (or a better way to go 
>> about this)?
>>
>> Thanks
>> ~Brian
>>
>>

-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to