<Controller>
def index():
    select_list = (Create a SELECT of options with the 
_onchange="ajax('ajax_requery',['selectlist'],'div_grid')
   
    grid = SQLFORM.grid(...)
   
    div_grid = DIV(grid, _id="div_grid")

    return dict(div_grid = div_grid, select_list=select_list)

def ajax_requery():
    #called by Ajax, returns grid, ajax() puts it in DIV = "div_grid"
    grid = SQLFORM.grid(...)
    return grid

<View>

{{=select_list}}
{{=div_grid}}


Issue I'm seeing:
On the 1st visit to the controller and I press "Add" on the grid, and all 
works well.  The browser is sent to:
/App/controller/index/new/...  A create form is created by the grid...

If I change the select list and cause the ajax function (ajax_requery) to 
put a new grid into the DIV "div_grid", then press "Add" on the inserted 
grid, the _href on the "Add" button causes the browser to be sent to:
/App/controller/*ajax_requery*/new...   Causing the grid to fail

I feel like I'm missing a best practice design pattern and wanted to ask 
the best way to accomplish the above.    I could go in with the DOM and 
edit the _href of the grid button, but that seems pretty hacky...  Figure 
there's a better way.

Thanks in advance.

-- 
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