This library implements a table with the following functionalities:
-
Search
User can filter data based on regular expressions. The columns are separated by #{column number}#. For example, when you want to search in the third column you type : #3#{regular expression}
-
Pagination
It defines which entries should appeared on the screen.The default number of entries a page can show is 10. User can change this using the selection box. It also offers the ability to navigate through pages.
-
Sort
User can sort the table based on the column he clicks. Sorting is performed using a permutation table. The list doesn't change so the original sequence can be restored
You can run the example using the following command:
git clone https://github.com/zgeorg03/table-elm.git && cd table-elm && elm-reactor
http://localhost:8000/src/TableExample.elm
The library is divided into the following components:
-
Value
Defines all the possible types used by the other modules.
-
Cell
Represents a single cell of the table. Its value can be hidden.
-
Record
Represents one entry in a table. It uses a list of cells.
-
Header
Represents the header of the table. It controls the state of each column. State can be ascending,descending or original( as given).
-
Pagination
Controls the view of the table. It breaks the view into pages showing a specified number of records.
-
Search
During initialization the list of data is provided. The user can filter the data using regular expressions.
-
Table
Table connects all the components together, providing them the data.
-
Native/SafeRegex
A clone of regex module provided by elm/core package, with a new function that returns a Result instead of a Regex. This is necessary because the user types custom regular expressions and the regex module doesn't provide a way to avoid program crash.
- Column should know the data type not the cell
- Take into consideration evancz/elm-sortable-table implementation in order to generalize this library in a better way.