You helped me a lot, man! i´ve tried like you suggested, i only keeped the LOAD, but it´s the same... Page is loading the Grid, underneath the Grid rises "loading" and then a new layer pops up with with the form in the default Template (Its showed twice).
I´ve checked: www.web2py.com/AlterEgo/default/show/252 But it doesent´t helped very much. It seems I am stucked, right before finish... ;-( Any help is appreciated, would so cool if I could get this done today. Dieter Asman On 20 Mai, 17:23, Jason Lotz <jayl...@gmail.com> wrote: > web2py LOAD function will create generate <div > id="target">Loading...</div> and fills your component. I'm sorry I can't > test it right now but it seems that by adding the <div></div> in your > view and including the LOAD you are creating two form. Maybe try remove > your div and only keep the LOAD. > > {{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> > {{=LOAD('default','form',args=1,ajax=True,target='my_form')}} > > check out LOAD function dochttp://www.web2py.com/AlterEgo/default/show/252 > > On 05/21/2010 12:09 AM, AsmanCom wrote: > > > Many thanks, it go�s in the right direction now. > > > I am using > > thehttp://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() > >>>>>>>>> { > > ... > > Erfahren Sie mehr »