web/views/tableview.py
changeset 8190 2a3c1b787688
parent 8159 f8678956bd05
child 8349 fdb796435d7b
equal deleted inserted replaced
8189:2ee0ef069fa7 8190:2a3c1b787688
    68 from types import MethodType
    68 from types import MethodType
    69 
    69 
    70 from logilab.mtconverter import xml_escape
    70 from logilab.mtconverter import xml_escape
    71 from logilab.common.decorators import cachedproperty
    71 from logilab.common.decorators import cachedproperty
    72 from logilab.common.deprecation import class_deprecated
    72 from logilab.common.deprecation import class_deprecated
       
    73 from logilab.common.registry import yes
    73 
    74 
    74 from cubicweb import NoSelectableObject, tags
    75 from cubicweb import NoSelectableObject, tags
    75 from cubicweb.selectors import yes, nonempty_rset, match_kwargs, objectify_selector
    76 from cubicweb.predicates import nonempty_rset, match_kwargs, objectify_predicate
    76 from cubicweb.schema import display_name
    77 from cubicweb.schema import display_name
    77 from cubicweb.utils import make_uid, js_dumps, JSString, UStringIO
    78 from cubicweb.utils import make_uid, js_dumps, JSString, UStringIO
    78 from cubicweb.uilib import toggle_action, limitsize, htmlescape, sgml_attributes, domid
    79 from cubicweb.uilib import toggle_action, limitsize, htmlescape, sgml_attributes, domid
    79 from cubicweb.view import EntityView, AnyRsetView
    80 from cubicweb.view import EntityView, AnyRsetView
    80 from cubicweb.web import jsonize, component
    81 from cubicweb.web import jsonize, component
    81 from cubicweb.web.htmlwidgets import (TableWidget, TableColumn, MenuWidget,
    82 from cubicweb.web.htmlwidgets import (TableWidget, TableColumn, MenuWidget,
    82                                       PopupBoxMenu)
    83                                       PopupBoxMenu)
    83 
    84 
    84 
    85 
    85 @objectify_selector
    86 @objectify_predicate
    86 def unreloadable_table(cls, req, rset=None,
    87 def unreloadable_table(cls, req, rset=None,
    87                        displaycols=None, headers=None, cellvids=None,
    88                        displaycols=None, headers=None, cellvids=None,
    88                        paginate=False, displayactions=False, displayfilter=False,
    89                        paginate=False, displayactions=False, displayfilter=False,
    89                        **kwargs):
    90                        **kwargs):
    90     # one may wish to specify one of headers/displaycols/cellvids as long as he
    91     # one may wish to specify one of headers/displaycols/cellvids as long as he
   858     entity_sortvalue = None # column not sortable by default
   859     entity_sortvalue = None # column not sortable by default
   859 
   860 
   860 
   861 
   861 class EntityTableView(TableMixIn, EntityView):
   862 class EntityTableView(TableMixIn, EntityView):
   862     """This abstract table view is designed to be used with an
   863     """This abstract table view is designed to be used with an
   863     :class:`is_instance()` or :class:`adaptable` selector, hence doesn't depend
   864     :class:`is_instance()` or :class:`adaptable` predicate, hence doesn't depend
   864     the result set shape as the :class:`TableView` does.
   865     the result set shape as the :class:`TableView` does.
   865 
   866 
   866     It will display columns that should be defined using the `columns` class
   867     It will display columns that should be defined using the `columns` class
   867     attribute containing a list of column ids. By default, each column is
   868     attribute containing a list of column ids. By default, each column is
   868     renderered by :class:`EntityTableColRenderer` which consider that the column
   869     renderered by :class:`EntityTableColRenderer` which consider that the column