On Saturday, August 17, 2019 at 9:22:15 AM UTC-7, Flavio Bovio wrote:
>
>
> *Add and edit button links are created incorrectly when the grid is inside 
> another view. With the smartgrid works ok.*
>
> *Add button link*
> http://localhost:8000/erp_proto/tablas_grales/index/addt/forma_pago           
>              
> Return None
>
> *Should be*
>
> http://localhost:8000/erp_proto/tablas_grales/index/forma_pago/add/forma_pago
>
> *Edit button link*
> http://localhost:8000/erp_proto/tablas_grales/index/edit/forma_pago/1         
>                
> Return None
>
> *Should be*
>
> http://localhost:8000/erp_proto/tablas_grales/index/forma_pago/edit/forma_pago/1
>
>
>
> *CONTROLLER*
> def index():
>
>     if request.args(0) == 'forma_pago':
>         grid = SQLFORM.grid(db.forma_pago, csv=False, 
> user_signature=False, details=False, advanced_search=False)
>         return dict(grid=grid, enc='Formas de Pago')
>
>     if request.args(0) == 'vendedores':
>         grid = SQLFORM.grid(db.vendedores, csv=False, 
> user_signature=False, details=False, advanced_search=False)
>         return dict(grid=grid, enc='Vendedores')
>
>     if request.args(0) == 'tipo_documento':
>         grid = SQLFORM.grid(db.tipo_documento, csv=False, 
> user_signature=False, details=False, advanced_search=False)
>         return dict(grid=grid, enc='Tipos de Documento')
>
>     if request.args(0) == 'situacion_iva':
>         grid = SQLFORM.grid(db.situacion_iva, csv=False, 
> user_signature=False, details=False, advanced_search=False)
>         return dict(grid=grid, enc='Situaciones IVA')
>
> *VIEW*
>
> {{extend 'layout.html'}}
>
> <div>
> <h4>TABLAS GENERALES</h4>    
> <div class="breaker"></div>
> <h4 >
> {{=A('FORMAS PAGO'    , _href=URL('tablas_grales','index', 
> args='forma_pago')    , _class="btn btn_secondary")}}
> {{=A('VENDEDORES'     , _href=URL('tablas_grales','index', 
> args='vendedores')    , _class="btn btn_secondary")}}
> {{=A('TIPOS DOCUMENTO', _href=URL('tablas_grales','index', 
> args='tipo_documento'), _class="btn btn_secondary")}}
> {{=A('SITUACION IVA'  , _href=URL('tablas_grales','index', 
> args='situacion_iva') , _class="btn btn_secondary")}}
> </h4>
> </div>
>
> <div class="breaker"></div>
>
> <hr/>
> <h4>{{=enc}}</h4>
> {{=grid}}
> </div>
> </div>
>
>

I'm not a grid expert, but looking at the gluon code, it appears the button 
code depends on the current grid name for generating Edit and Delete 
buttons.  You may want to look at the links argument to grid ("used to 
display new columns which can be links to other pages"), and is a dict with 
a column head value and a 'body" function that returns a value (such as an 
A() helper) when given a row.

See 
<URL:http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-grid-signature>

/dps

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/ad47b78e-fd41-419c-92d7-defa95a6acf6%40googlegroups.com.

Reply via email to