Many thanks, it go´s in the right direction now.

I am using the http://app.ebansoftware.net/editable_jqgrid/default/show_example
, but it is quite similar.

Now the is loaded is loaded with the default template and then a
second layer covers it with the form and the default Template(loaded
twice)

The code so far:

View:

{{extend 'layout.html'}}
<h1>This is the default/test.html template</h1>
{{=jqgrid_table}}
<script type="text/javascript">
jQuery(document).ready(function()
{jQuery("#grid_id").jqGrid({onSelectRow: function(postdata)
{web2py_ajax_page('get','/myapp/default/form/'+
(postdata),null,'my_form');}});
</script>
<div id="my_form"></div>
{{=LOAD('default','form',args=1,ajax=True,target='my_form')}}

Controller:

def jqgrid_table_test():
    return
dict(jqgrid_table=plugin_editable_jqgrid(db.jqgrid_table,grid_name='jqgrid_table',db_name='db'))

def form():
    #id = request.args[0]
    form = SQLFORM(db.jqgrid_table)
    if form.accepts(request.vars, session):
        response.flash = 'form accepted'
    elif form.errors:
        response.flash = 'form has errors'
    else:
        response.flash = 'please fill out the form'
    return dict(form=form)

On 20 Mai, 16:55, Jason Lotz <jayl...@gmail.com> wrote:
> Are you using the web2py jqgrid_plugin?
>
> http://web2py.com/plugins/default/jqgrid
>
> On 05/20/2010 11:53 PM, AsmanCom wrote:
>
> > can this be caused by the function, which set in /static/
> > plugin_editable_jqgrid/plugin_editable_jqgrid.js ?:
>
> >     onSelectRow: function(id){
> >       if(id&&  lastSel!=''&&  id!==lastSel){
> >          jQuery(grid_name).restoreRow(lastSel);
> >       }
> >       lastSel=id;
> >       jQuery(grid_name).editRow(id, true, '', '', '', '',
> > function(rowid, resultText){reload(grid_name,rowid, resultText);});
> >     },
> >      colNames:col_names,
> >      colModel:col_models,
> >      pager: pager,
> >      rowNum:10,
> >      rowList:[10,100,1000],
> >      sortorder: 'desc',
> >      multiselect: true,
> >      multiboxonly:true,
> >      viewrecords: true,
> >      editurl:edit_url,
> >      caption: caption
> >    });
>
> > Thank  you in advance.
>
> > Dieter Asman
>
> > On 20 Mai, 15:52, Jason Lotz<jayl...@gmail.com>  wrote:
>
> >> Try
>
> >> {{=jqgrid_table}}
> >> <script type="text/javascript">
> >> jQuery(document).ready(function(){
> >> jQuery("#grid_id").jqGrid({
> >>       onSelectRow: function(postdata) {
> >> web2py_ajax_page('get','/myapp/default/form/'+(postdata),null,'my_form');}});
> >> </script>
>
> >> On 05/20/2010 10:45 PM, AsmanCom wrote:
>
> >>> Thanks for your effort, but it gives an empty page..
> >>> I will use two or more Grids at least one of them must keep the
> >>> "editable" behaveure.
> >>> But in this case it should work like your approach, controlling the
> >>> form.
>
> >>> May i missed something..?
> >>> Could you tell me how to set up the form?
>
> >>> should the view look something like that?:
>
> >>> {{=jqgrid_table}}
> >>> <script>
> >>> jQuery("#grid_id").jqGrid({
> >>>       onSelectRow: function(postdata) {
> >>>               web2py_ajax_page('get','/myapp/default/form/'+
> >>> (postdata),null,'my_form');
> >>>       }
>
> >>> });
> >>> </script>
> >>> <div id='my_form'></div>
> >>> {{=form}}
>
> >>> Thank  you in advance.
>
> >>> Dieter Asman
>
> >>> On 20 Mai, 14:54, Jason Lotz<jayl...@gmail.com>    wrote:
>
> >>>> You could try passing SCRIPT from the controller.
>
> >>>> ## View
> >>>> {{extend 'layout.html'}}
> >>>> <h1>This is the default/test.html template</h1>
> >>>> {{=plugin_editable_jqgrid(db.jqgrid_table,grid_name='jqgrid_
> >>>> table',db_name='db')}}
> >>>> {{=script}}
>
> >>>> ## Controller
> >>>> def jqgrid_table_test():
> >>>>       script = """jQuery(document).ready(function(){
> >>>>                       jQuery("#grid_id").jqGrid({
> >>>>                           onSelectRow: function(postdata)
> >>>> {web2py_ajax_page('get','/myapp/default/form/'+
> >>>> (postdata),null,'my_form'); }});"""
> >>>>       return SCRIPT(script)
>
> >>>> I haven't tested this so let me know if it works out for you.
>
> >>>> I am only using a single grid for my app so I actually included the
> >>>> onSelectRow event to /models/jqgrid_plugin. The function
> >>>> plugin_jqgrid() is where the default jqgrid script is retrieved when
> >>>> the {{=plugin_jqgrid(db.table,columns=[...])}} is called. If you do it
> >>>> this way you will want to add it to the .jqGrid({ }) parameters not in
> >>>> the 'navGrid', 'toolbar' or other extended option parameters.
>
> >>>> Jay
>
> >>>> On May 20, 8:47 pm, AsmanCom<d.as...@web.de>    wrote:
>
> >>>>> Could you help me setting this up too?
>
> >>>>> This is the view:
>
> >>>>> {{extend 'layout.html'}}
> >>>>> <h1>This is the default/test.html template</h1>
> >>>>> {{=jqgrid_table}}
> >>>>> jQuery("#grid_id").jqGrid({
> >>>>>       onSelectRow: function(postdata) {
> >>>>>               web2py_ajax_page('get','/myapp/default/form/'+
> >>>>> (postdata),null,'my_form');
> >>>>>       }
>
> >>>>> });
>
> >>>>> This is the Controller:
>
> >>>>> def jqgrid_table_test():
> >>>>>       return
> >>>>> dict(jqgrid_table=plugin_editable_jqgrid(db.jqgrid_table,grid_name='jqgrid_
> >>>>>  table',db_name='db'))
>
> >>>>> def form():
> >>>>>       id = request.args[0]
> >>>>>       form=FORM(TABLE(TR("Your
> >>>>> name:",INPUT(_type="text",_name="name",requires=IS_NOT_EMPTY())),
> >>>>>                       TR("Your
> >>>>> email:",INPUT(_type="text",_name="email",requires=IS_EMAIL())),
> >>>>>                       TR("Admin",INPUT(_type="checkbox",_name="admin")),
>
> >>>>> TR("Sure?",SELECT('yes','no',_name="sure",requires=IS_IN_SET(['yes','no']))
> >>>>>  ),
> >>>>>                       TR("Profile",TEXTAREA(_name="profile",value="write
> >>>>> something here")),
> >>>>>                       TR("",INPUT(_type="submit",_value="SUBMIT"))))
> >>>>>       if form.accepts(request.vars,session):
> >>>>>           response.flash="form accepted"
> >>>>>       elif form.errors:
> >>>>>           response.flash="form is invalid"
> >>>>>       else:
> >>>>>           response.flash="please fill the form"
> >>>>>       return dict(form=form,vars=form.vars)
>
> >>>>> ################################################
>
> >>>>> The JQGrid works, but underneath the Grid i only see the following
> >>>>> text:
> >>>>> jQuery("#grid_id").jqGrid({ onSelectRow: function(postdata)
> >>>>> { web2py_ajax_page('get','/core/default/form/'+
> >>>>> (postdata),null,'my_form'); } });
>
> >>>>> It would be very nice if you could help me gettin this to work.
> >>>>> Thank  you in advance.
>
> >>>>> Dieter Asman
>
> >>>>> On 17 Mai, 08:22, Jason Lotz<jayl...@gmail.com>    wrote:
>
> >>>>>> Thanks mdipierro!!
>
> >>>>>> I actually saw that in the header of the generated page but didn't put
> >>>>>> it together. For what ever reason, trying to call web2py_component
> >>>>>> from another function wouldn't work, but calling web2py_ajax_page
> >>>>>> directly worked!
>
> >>>>>> Working code:
>
> >>>>>> jQuery("#grid_id").jqGrid({
> >>>>>>       onSelectRow: function(postdata) {
> >>>>>>               web2py_ajax_page('get','/Test/default/a_form/'+
> >>>>>> (postdata),null,'my_form');
> >>>>>>       }
>
> >>>>>> });
>
> >>>>>> Jay
>
> >>>>>> On May 17, 2:35 pm, mdipierro<mdipie...@cs.depaul.edu>    wrote:
>
> >>>>>>> This is the definition of web2py_component
>
> >>>>>>> function web2py_component(action,target)
> >>>>>>> {
> >>>>>>>       jQuery(document).ready(function()
> >>>>>>> { web2py_ajax_page('get',action,null,target); });
>
> >>>>>>> }
>
> >>>>>>> I think you just want to call web2py_ajax_page instead of
> >>>>>>> web2py_component.
>
> >>>>>>> On May 16, 11:50 pm, Jason Lotz<jayl...@gmail.com>    wrote:
>
> >>>>>>>> I was using an iframe to show the details of a selected row from
> >>>>>>>> jqgrid. Which worked. However I realized that it is a pain to get
> >>>>>>>> iframe to recognize parent size so resizing produces an awkward
> >>>>>>>> looking form. I came across web2py LOAD helper and thought it to be a
> >>>>>>>> good fix to my frame resizing issue.
>
> >>>>>>>> I'm trying to change a LOAD(form) based on the row_id from a selected
> >>>>>>>> row in jqgrid. Using the jqgrid event onSelectRow I'm trying to
> >>>>>>>> trigger web2py_component to reload the form.
>
> >>>>>>>> I came up with a test link to update the form, which worked.
>
> >>>>>>>>      <a href="#"
> >>>>>>>> onclick="web2py_component('{{=URL(...)}}','my_form');">Load Page 
> >>>>>>>> 3</a>
> >>>>>>>>      {{=LOAD('default','a_form/1',ajax=True,target='my_form')}}
>
> >>>>>>>> If possible I would like to get jqgrid to trigger the same
> >>>>>>>> web2py_component feature.
>
> >>>>>>>> My latest failed attempt was something like
>
> >>>>>>>> jQuery(document.ready(function(){
> >>>>>>>>       onSelectRow: function()
> >>>>>>>> { jQuery("#my_form").trigger('web2py_component',['/Test/default/
> >>>>>>>> a_form/'+(postdata),'my_form']);}
> >>>>>>>> ;})
>
> >>>>>>>> Is it possible to trigger web2py_component function or LOAD helper
> >>>>>>>> without an action input (button or link)?
>
> >>>>>>>> Jay
>
>

Reply via email to