Depends on how you're implementing the widget.
I've got a CKEditor widget as follows (pretty much a glorified copy of
text.widget with the ckeditor class):
class CKEditor(FormWidget):
_class = 'ckeditor'
@classmethod
def widget(cls, field, value, **attributes):
"""
generates a TEXTAREA tag.
see also: :meth:`FormWidget.widget`
"""
default = dict(value=value)
attr = cls._attributes(field, default, **attributes)
return TEXTAREA(**attr)
Used in the model, it's:
idb.define_table(
'module',
Field('id', 'id', readable=False),
...
Field('description', 'text', widget=CKEditor.widget)
)
So to do what you're suggesting, I change it to:
def hideable_ckeditor_widget():
return SQLFORM.widgets.text.widget if 'new' in request.args or 'edit'
in request.args else CKEditor.widget
idb.define_table(
'module',
Field('id', 'id', readable=False),
...
Field('description', 'text', widget=hideable_ckeditor_widget())
)
On Sunday, February 1, 2015 at 9:25:35 AM UTC, Serge Bourgeois wrote:
>
> I just implemented the ckeditor plugin. It looks great, but I need help
> (example if possible) showing how to hide the ckeditor toolbar for some
> text fields, for instance in a controller with a smartgrid, where
> request.args does not contain 'now' nor 'edit'.
> Thanks in advance !
> Serge
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.