Try to give a each grid a uniq formname:

SQLFORM.grid(db.post, formname=‘grid_post’)

SQLFORM.grid(db.post, formname=‘grid_comments’)

On Wed, Mar 16, 2016 at 1:25 AM, Ron Chatterjee <achatterjee...@gmail.com>
wrote:

> Basically, I go to panel one and "view" the grid element. And if I click
> on "back" button it takes me to panel2 content even though it says panel1.
> And vice versa.
>
>
> On Tuesday, March 15, 2016 at 8:21:59 PM UTC-4, Ron Chatterjee wrote:
>>
>> I used the LOAD but seems to be the problem still there. See attached pic
>>
>>
>> My Model
>>
>> db.define_table('post',
>>             Field("title", "string", length=128, default=""),
>>             Field("contents", "text", length=512, default=""),
>>             Field("created_on", "date", default=None),
>>             )
>>
>> if not db(db.post).count():
>>     from gluon.contrib.populate import populate
>>     populate(db.post,25)
>>
>> db.define_table('comments',
>>             Field("title", "text", length=128, default=""),
>>             Field("contents", "string", length=512, default=""),
>>             Field("created_on", "date", default=None),
>>             )
>>
>> if not db(db.comments).count():
>>     from gluon.contrib.populate import populate
>>     populate(db.comments,25)
>>
>>
>>
>> Controller:
>>
>> def first_action():
>>     grid1 = SQLFORM.grid(db.post)
>>     return dict(grid1 = grid1)
>>
>> def second_action():
>>     grid2 = SQLFORM.grid(db.comments)
>>     return dict(grid2 = grid2)
>>
>>
>> def tab_panel():
>>     return locals()
>>
>>
>>
>> View:
>>
>> {{extend 'layout.html'}}
>>
>> <div class="container">
>>   <h2>My Dashboard</h2>
>>   <ul class="nav nav-tabs">
>>     <li class="active"><a data-toggle="tab" href="#home">My
>> Projects</a></li>
>>     <li><a data-toggle="tab" href="#menu1">My Files</a></li>
>>     <li><a data-toggle="tab" href="#menu2">Menu 2</a></li>
>>     <li><a data-toggle="tab" href="#menu3">Menu 3</a></li>
>>   </ul>
>>
>>   <div class="tab-content">
>>     <div id="home" class="tab-pane fade in active">
>>       <p>{{=LOAD('default','first_action.load',ajax=True)}}</p>
>>     </div>
>>     <div id="menu1" class="tab-pane fade">
>>
>>       <p>{{=LOAD('default','second_action.load',ajax=True)}}</p>
>>     </div>
>>     <div id="menu2" class="tab-pane fade">
>>       <h3>Menu 2</h3>
>>       <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem
>> accusantium doloremque laudantium, totam rem aperiam.</p>
>>     </div>
>>     <div id="menu3" class="tab-pane fade">
>>       <h3>Menu 3</h3>
>>       <p>Eaque ipsa quae ab illo inventore veritatis et quasi architecto
>> beatae vitae dicta sunt explicabo.</p>
>>     </div>
>>   </div>
>> </div>
>>
>>
>>
>> On Wednesday, March 2, 2016 at 4:24:26 PM UTC-5, Ron Chatterjee wrote:
>>>
>>> Thank you Val. Appreciate the help.
>>>
>>> On Wednesday, March 2, 2016 at 1:51:58 PM UTC-5, Val K wrote:
>>>>
>>>> As I know it's impossible to have 2 "static" (not ajax)  SQLFORM.grids
>>>> at the same page, because each of them will treat request.args  as its own
>>>>
>>>> Use {=LOAD(... , ajax=True)}
>>>>
>>>> And I think  you have to have different controllers to process them or
>>>> one controller that will return different results depends on "whose
>>>> requests" - return dict(grid= grid1)  or  return dict(grid= grid2)  not
>>>> both!
>>>>
>>>>
>>>> On Wednesday, March 2, 2016 at 8:12:49 PM UTC+3, Ron Chatterjee wrote:
>>>>>
>>>>>
>>>>> If I have two independent grid, when I search in one grid, it gets
>>>>> redirected to the other tab. And I noticed this with other tab panel as
>>>>> well.
>>>>>
>>>>>
>>>>>
>>>>> <div id="tabs">
>>>>>   <ul>
>>>>>     <li><a href="#fragment-1"><span>My Projects</span></a></li>
>>>>>     <li><a href="#fragment-2"><span>My Payments</span></a></li>
>>>>>     <li><a href="#fragment-3"><span>My Contacts</span></a></li>
>>>>>   </ul>
>>>>>   <div id="fragment-1">
>>>>>
>>>>>       {{=grid1}}
>>>>>   </div>
>>>>>   <div id="fragment-2">
>>>>>     {{=grid2}}
>>>>>   </div>
>>>>>   <div id="fragment-3">
>>>>>     Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam
>>>>> nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
>>>>> volutpat.
>>>>>     Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam
>>>>> nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
>>>>> volutpat.
>>>>>     Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam
>>>>> nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
>>>>> volutpat.
>>>>>   </div>
>>>>> </div>
>>>>>
>>>>> <script>
>>>>> $( "#tabs" ).tabs();
>>>>> </script>
>>>>>
>>>>> --
> 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.
>



-- 
Massimiliano

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