This commit is contained in:
2018-11-28 23:41:22 +00:00
parent c2ab4c5afc
commit 6e99dee09b
2 changed files with 39 additions and 1 deletions

View File

@@ -0,0 +1,33 @@
LIST / GRAPH FILTERING AND PAGING
This all applies equally to a report or a list or a graph so all work basically the same but will refer only to "list" for simplicity:
At client user can view a list and select from a dropdown of saved filters for that type of list which corresponds to an api route.
User creates filters in separate UI from the actual list, i.e. clicks on the filter button above a list to make or edit filter.
Two types of filters Named or Default:
User can save a filter with a name for later selection or it will always default to "Default" (localized) if not edited but will always require saving to server.
Generic "default" filter is always personal, not public / shared
Named filters can be made public or personal. If public then all users with rights to that object can see them, personal are always only personal.
Filter is constructed from an FILTEROPTIONS object fetched from the server list route that has a list type name which is unique to that list route and also lists all the fields filterable, their type and the locale key to display it
- e.g.: {list:"widget",fields:[{fld:"name",lt:"WidgetName",type:"text"},{fld:"dollarAmount",lt:"WidgetDollarAmount",type:"currency"}]}
Certain types have extended abilities, for example dates have the classic floating AyaNova date ranges pre-defined or specific dates
Filters are saved to the database:
- Filter: Name, UserId, List, Filter (Json string) (column names to be determined)
- i.e. "My widget filter", 1, "widget", "[{fld:"name",comparisonoperator:"Like",value:"Bob*"},{fld:"tags",comparisonoperator:"Eq",value:"[23,456,54]"}]
- means all widgets that start with the name "Bob" and are tagged with tags with id values 23, 456 and 54
Upon user selecting a filter to use the list query string has the regular paging info but also the filter id as a query parameter
- Server loads the filter if it's public or has the user ID if it's personal only
- If list not found then it will return a 404 instead of the list
- server loads the filter, generates the sql based on the stored filter, adds the sort by and offset / page, runs the query and then returns the data as json collection to the client
LIST FILTERING TODO
- Implement this with widget list first
- Add Filter table and models and route to save, edit
- Add API route to widget list that returns the FILTEROPTIONS object as outlined above
- Add a list route that accepts the current paging options and also a filter id
- A method that can take the list of field filter values and the field types and construct an sql query from it