Skip to content
Snippets Groups Projects
Commit 39705d61 authored by Matthieu Fesselier's avatar Matthieu Fesselier
Browse files

Merge branch 'dev' into 'master'

solid-table and sorted-by

See merge request !47
parents 0187479a e1c31a31
No related branches found
No related tags found
1 merge request!47solid-table and sorted-by
Pipeline #9441 passed
......@@ -118,6 +118,13 @@ Attributes
Equal to the value ``off``, it cancels the automatic entry of values in the relevant ``[field]``.
It can be added to ``inputs``, ``textarea`` and ``select``.
``autosave``
~~~~~~~~~~~~
*Available from version 0.16*
If the attribute is defined, each change in an input will trigger a request to update the resource.
This attribute works only when editing resources, not creating them.
Widgets
-------
By default, the widget used is ``<solid-form-label-text>``. Cf the
......
.. _solid-table:
solid-table
=============
*Available from version 0.16*
Receives the URL of a resource or of a container of resources via its
``data-src`` attribute, and displays it in a `table`. Each resource is a line (``<tr>``)
and each field is a cell (``<td>``).
Like for the ``solid-display``, custom widgets can be specified for each
field. Filters and searching capabilities can be easily
added to interact with the list of data being displayed.
.. code:: html
<solid-table
data-src="https://server/users/"
fields="first_name, last_name"
></solid-table>
Mixins
------
This component uses the following mixins:
* :ref:`required-mixin <required-mixin>`
* :ref:`counter-mixin <counter-mixin>`
* :ref:`federation-mixin <federation-mixin>`
* :ref:`filter-mixin <filter-mixin>`
* :ref:`grouper-mixin <grouper-mixin>`
* :ref:`highlighter-mixin <highlighter-mixin>`
* :ref:`list-mixin <list-mixin>`
* :ref:`paginate-mixin <paginate-mixin>`
* :ref:`sorter-mixin <sorter-mixin>`
* :ref:`store-mixin <store-mixin>`
* :ref:`widget-mixin <widget-mixin>`
Please check their documentation to know more about their capabilities.
Attributes
----------
``fields``
~~~~~~~~~~
By default, all displayed fields are direct children of
``<solid-display>``. Make sure you don’t give your set the same name as
a field as it would result in an infinite loop.
``header``
~~~~~~~~~~
If defined, adds a header line at the top of the table.
You can customize each header by setting a ``label-[field]`` attribute.
``selectable``
~~~~~~~~~~~~~~
If defined, adds checkboxes at the beginning of each line.
If the ``header`` attribute is defined, a checkbox will also be added to the headline
to select/unselect all the lines.
You have access to the selected lines in Javascript, like this:
.. code:: javascript
document.querySelector('solid-table').component.selectedLines
// returns [ "resourceId1", "resourceId2" ]
``editable-[field]``
~~~~~~~~~~~~~~~~~~~~
Makes a cell editable by creating a solid-form in the cell.
This form will be saved automatically when a change is detected.
You can customize the attributes of the form by setting them like this:
.. code:: html
<solid-table
data-src="https://server/users/"
fields="first_name"
editable-first_name
widget-first_name="solid-form-placeholder-text"
placeholder-first_name="Your First Name"
></solid-table>
Widgets
-------
By default, the widget used is ``<solid-display-value>``. Cf the
`Widget <https://docs.startinblox.com/import_documentation/Widgets/Reference.html>`__ page for more info.
......@@ -41,4 +41,36 @@ Attributes
data-src="http://server/users/"
fields="username"
order-by-random
></solid-display>
``sorted-by``
~~~~~~~~~~~~~
*Available from version 0.16*
Target a ``<solid-form-search>`` used to provide several options for the user to sort current list of resource.
The ``fields`` attribute of ``<solid-form-search>`` must at least contain ``field``.
``Field`` attribute contains the fields of the resource to be offered to the user for sorting the data.
``Order`` attribute allows you to propose 2 sorting orders: ascending (``asc`) and descending (``desc``).
By default, the order is ascending.
The ``<solid-display>`` cannot combine ``order-asc`` or ``order-desc`` attribute AND ``sorted-by`` attribute.
example:
.. code:: html
<solid-form-search
id="my-sorter"
fields="field, order"
enum-field="username, email"
enum-order="ascending order = asc, descending order = desc"
></solid-form-search>
<solid-display
data-src="http://server/users"
fields="username, last_name, email"
sorted-by="my-sorter"
></solid-display>
\ No newline at end of file
......@@ -192,6 +192,10 @@ List of attributes (core framework)
~~~~~~~~~~~~~~~~~~~~
* :ref:`required-mixin <required-mixin>`
``sorted-by``
~~~~~~~~~~~~~~~
* :ref:`sorter-mixin <sorter-mixin>`
``start-value-[field]``
~~~~~~~~~~~~~~~~~~~~~~~
* :ref:`solid-form-search <solid-form-search>`
......
......@@ -41,6 +41,7 @@ Welcome to Startinblox's documentation
import_documentation/Components/Solid-Ac-Checker
import_documentation/Components/Solid-Widget
import_documentation/Components/Solid-Lang
import_documentation/Components/Solid-Table
.. toctree::
:maxdepth: 2
......
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