[web2py] Re: How hide comments column (w2p_fc) from SQLFORM.grid() when edit some record

2013-04-22 Thread 黄祥
i think you can achieve it by some conditional in models or controller.

e.g.
db.define_table('test',
Field('test'),
Field('test_read'),
Field('test_write'),
format='%(test)s')

*# not show in edit page*
show_test_write = request.args(-3) == 'edit'
db.test.test_write.writable = db.test.test_write.readable = not 
show_test_write

# not show in new page
show_test_read = request.args(-2) == 'new'
db.test.test_read.writable = db.test.test_read.readable = not show_test_read

# not show in new and edit page
show_test = request.args(-2) == 'new' or request.args(-3) == 'edit'
db.test.test.writable = db.test.test.readable = not show_test

hope this can help.

-- 

--- 
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/groups/opt_out.




[web2py] Re: How hide comments column (w2p_fc) from SQLFORM.grid() when edit some record

2013-04-24 Thread Mark
SQLFORM.grid(, editargs=dict(comments=False))

or 

SQLFORM.grid(, formstyle='bootstrap')


On Monday, April 22, 2013 2:15:35 PM UTC-4, Christian Espinoza wrote:
>
> Hi guys, somebody know how hide the comments column at a edit form using 
> SQLFORM.grid() ??
>
> I can do it using jquery with:
>
> $("tr td:nth-child(3)").each(function(){this.remove()});
>
> But 'm finding a server side(controllers maybe) way to do it..
>  
> 
> 
>  id="velocities_id__label">Id:  "velocities_id">1
>  "velocities_customer" id="velocities_customer__label">Cliente: 
>  "velocities_customer" name="customer" disabled="disabled"> >Intsercom Ltda
> 
>  "velocities_name" id="velocities_name__label">Nombre:  class="w2p_fw"> ="text" value="Ciudad" size="18" maxlength="14"> >
>  "velocities_max" id="velocities_max__label">Velocidad Maxima: 
>  name="max" type="number" value="40" min="10" max="200" maxlength="5" size=
> "6">
>  id="delete_record__label">Marque para eliminar:  "w2p_fw"> "delete_this_record" type="checkbox" value="on"> >
>  >
> 
> 
>
> Thanks in advance.
> Christian.
>

-- 

--- 
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/groups/opt_out.




[web2py] Re: How hide comments column (w2p_fc) from SQLFORM.grid() when edit some record

2013-04-25 Thread Christian Espinoza

Thanks Mark!

-- 

--- 
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/groups/opt_out.