Skip to content
Snippets Groups Projects
Commit 03f1d72f authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Review storemodifier.py documentation.

parent 1c4520eb
No related branches found
No related tags found
No related merge requests found
plugin_dbui.storemodifier.AddStore
==================================
.. currentmodule:: plugin_dbui.storemodifier
.. autoclass:: AddStore
.. rubric:: Methods
plugin_dbui.storemodifier.StoreModifier
=======================================
.. currentmodule:: plugin_dbui.storemodifier
.. autoclass:: StoreModifier
:show-inheritance:
.. rubric:: Methods
.. autosummary::
:toctree: storemodifier/
~StoreModifier.configure
~StoreModifier.orderby
~StoreModifier.set_buffered
plugin_dbui.storemodifier.StoreModifier.configure
=================================================
.. currentmodule:: plugin_dbui.storemodifier
.. automethod:: StoreModifier.configure
\ No newline at end of file
plugin_dbui.storemodifier.StoreModifier.orderby
===============================================
.. currentmodule:: plugin_dbui.storemodifier
.. automethod:: StoreModifier.orderby
\ No newline at end of file
plugin_dbui.storemodifier.StoreModifier.set_buffered
====================================================
.. currentmodule:: plugin_dbui.storemodifier
.. automethod:: StoreModifier.set_buffered
\ No newline at end of file
......@@ -15,10 +15,10 @@ class AddStore(object):
""" A Ext JS store is associated to each database table. Their configuration
are derived from the table models using the :func:`.to_jsonstore`.
The Ext JS configuration options of all stores are kept in a
persistent dictionary of the plugin_dbui.
The configuration options are transported
to the client using the ``plugin_dbui/dbui_conf`` action.
The Ext JS configuration options for all stores are kept in a
persistent dictionary of the plugin_dbui. The configuration
options are transported to the client using
the ``plugin_dbui/dbui_conf`` action.
From time to time, it is useful to defined static store,
like ``Ext.data.ArrayStore``. This tool allows to defined them
......@@ -28,25 +28,24 @@ class AddStore(object):
This approach is generic and any store can be added to the
persistent dictionary.
"""
Args:
name (str): name of the store
def __init__(self, name, **kwargs):
""" Create the configuration option of an Ext JS Store.
Keyword Args:
**kwargs: any configuration options for the target store.
For example the ``Ext.data.ArrayStore`` requires the
keyword ``fields`` and ``data``. For more details see
the ExtJS documentation.
Args:
name (str): name of the store
Note:
The key associated to this store in the persistent dictionary
is the ``storeId``. Its value is derived from the store name,
*e.g.* ``nameStore``.
The keyword arguments contains the configuration options for
the store.
For an ``Ext.data.ArrayStore`` the keyword ``fields`` and ``data``
have to be defined. For more details see the ExtJS documentation.
"""
Note:
The key associated to this store in the persistent dictionary
is the ``storeId``. Its value is derived from the store name,
*e.g.* ``nameStore``.
def __init__(self, name, **kwargs):
"""
static_stores = PluginManager('dbui').dbui.static_stores
storeId = get_store_id(name)
......@@ -55,35 +54,27 @@ class AddStore(object):
class StoreModifier(Modifier):
"""Modifier to customize the store associated to a table.
Attributes:
data.orderby (list):
"""
"""Customise the Ext JS store associated to the database
table *tablename*.
def __init__(self, tablename):
"""Initialize the store modifier associated to the database
table ``tablename``.
The data structure of the store modifier can be access
outside the class::
Args:
tablename (str): name of the database table
p = PluginManager('dbui')
modifier = p.dbui['modifier_stores'][tablename]
Attributes:
data (gluon.storage.Storage): storage containing the
instructions to tune the store widgets. It has
two keys/attributes:
or internally via the attribute ``data``.
* **extjs** (dict): Ext JS configuration options
for ``Ext.data.Store`` object.
The keys of the ``data`` structure are:
* **order_by** (list): database fields to order the
content of the store
* ``extjs`` (dict) Ext JS configuration options for the store widget.
* ``order_by`` (list of gluon.dal.Field) list of fields to order
the content of the store
"""
Args:
tablename (str): name of the database table
def __init__(self, tablename):
"""
Modifier.__init__(self, MODIFIER_STORES, tablename)
if 'orderby' not in self.data:
......@@ -91,35 +82,33 @@ class StoreModifier(Modifier):
def orderby(self, *fields):
"""Order the store according to the list of gluon.dal.field.
"""Extend the list of database field to order the store content.
Args:
*fields: variable list of database field
"""
self.data.orderby.extend(fields)
def set_buffered(self, **kwargs):
""" The store is buffered.
The method set the following configuration options:
""" The grid buffering is activated.
The method set the following configuration options::
* autoLoad = False
* buffered = True
* clearOnPageLoad = True
* pageSize = 25
* leadingBufferZone = 0
* trailingBufferZone = 0
autoLoad = False
buffered = True
clearOnPageLoad = True
pageSize = 25
leadingBufferZone = 0
trailingBufferZone = 0
They can be overwritten using the keyword arguments.
The grid buffering is activate when the store is buffered.
That means that only 5 pages are kept in the cache. Therefore
this is a good option to manipulate almost infinite set of data.
Keyword Args:
kwargs (dict):
Any configuration parameter of the ``Ext.data.Store``.
Those related to the buffering are ``buffered``, ``clearOnPaqgeLoad``,
``leadingBufferZone``, ``pageSize``, ``purgePageCount``
and ``trailingBufferZone``.
kwargs (dict): the configuration parameter of
the ``Ext.data.Store`` related to the buffering, namely:
``buffered``, ``clearOnPaqgeLoad``, ``leadingBufferZone``,
``pageSize``, ``purgePageCount`` and ``trailingBufferZone``.
"""
di = dict(autoLoad=False,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment