yesod-datatables-0.1: Yesod plugin for DataTables (jQuery grid plugin)

Safe HaskellNone

Yesod.DataTables.Query

Description

This module is used to make database queries based on the DataTables request.

Synopsis

Documentation

data DataTable val Source

The functions in a DataTable define how search strings, column sorting, filtering and value fetching is implemented.

Constructors

DataTable 

Fields

dtGlobalSearch :: Text -> RegexFlag -> [Filter val]

mapping global search field to filters

dtSort :: [(ColumnName, SortDir)] -> [SelectOpt val]

mapping sorting instructions to select options

dtColumnSearch :: ColumnName -> Text -> RegexFlag -> [Filter val]

mapping a column search to filters

dtFilters :: [Filter val]

filters that are always applied

dtValue :: forall m. (PersistQuery m, PersistEntityBackend val ~ PersistMonadBackend m) => ColumnName -> Entity val -> m Text

mapping column name and entity to a textual value

dtRowId :: forall m. (PersistQuery m, PersistEntityBackend val ~ PersistMonadBackend m) => Entity val -> m Text

mapping entity to a row identifier

type RegexFlag = BoolSource

Type synonym for indicating whether a search string is a regular expression.

type ColumnName = TextSource

Name of DataTables grid column

dataTableSelect :: (PersistEntity val, PersistQuery m, PersistEntityBackend val ~ PersistMonadBackend m) => DataTable val -> Request -> m ReplySource

selects records from database and populates the grid columns using callback functions (which can issue follow-up queries)