Skip to content

A package for an HTML table with pagination, that offers an easy way to perform sorting and filtering

License

Notifications You must be signed in to change notification settings

zgeorg03/table-elm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

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


Example

You can run the example using the following command:

git clone https://github.com/zgeorg03/table-elm.git && cd table-elm && elm-reactor 

Visit

http://localhost:8000/src/TableExample.elm


Implementation

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.


Further Work

  1. Column should know the data type not the cell
  2. Take into consideration evancz/elm-sortable-table implementation in order to generalize this library in a better way.

About

A package for an HTML table with pagination, that offers an easy way to perform sorting and filtering

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published