Buy Now
Sign in

A method to build differents filters on differents fields on a view list, with paginator and sort columns

Colnem , February 23 2021, 12:41
Colnem 472
February 23 2021, 12:41 #396034
Hello guys
A method to build multiple different filters on multiple different fields on a view list, with paginator and sort columns
In my example, my-table has 12 different fields
I want to display 6 different fields on a view list
I want to put 4 different filters on 4 different fields
I will use a Chronoforms6 form under a form area, and session variables to maintain the filters
I call a Chronoconnectivy block by a menu link
Step 1: Chronoconnectivity6, event:index
This event define and set the session variables as empty

switch check-startat-empty
Data provider:{data/empty:startat}
Values setup: true:{fn:raz-startat}
Builder raz-startat: Type=Data, Name=startat, Value=0

step 2: Chronoconnectivity6, event list


Data provider:{session:}
Submit Event:filters

Model: model-list
Select type: All matching records
Paging: Enable, page limit=20
Where conditions
text-field1 LIKE %{session:keyword1}%, Null value Continue
text-field2 LIKE %{session:keyword2}%, Null value Continue
numeric-field3 = {session:keyword3}, Null value Continue
dropdown-field4 = {session:keyword4}, Null value Continue

Fields to retrieve
text field2


table: list
Data provider: {var:read-my-table}
Columns list
field1:label1 (or {view:widget-sort-field1})
model-list.field2:label2 (or {view:widget-sort-field2})
model-list.field3:label3 (or {view:widget-sort-field3})
model-list.field4:label4 (or {view:widget-sort-field4})
Columns view
field1: {view:link-details-record}
A view link to display 12 fields of the record, with a task-button
to return to Event:list maintening all filters}. To know more, go to Step 6.
Step 3: Chronoforms6, form-filters
form-filters is a very simple form, without actions neither permissions

Multifield area:
Text field 1: name=keyword1, value={session:keyword1}
Text field 2: name=keyword2, value={session:keyword2}
Text field 3 (numeric field): name=keyword3, value={session:keyword3}
Dropdown field 4:
=All values
Options (alternative code:
=All values
Selected value: {session:keyword4}

Button: Type=Submit
Step 4: Chronoconnectivity6, event:filters



Step 5: How to erase filters
{redirect:index} or display a menu link to Chronoconnectivity6, event:index on a module
Step 6 (optional): Chronoconnectivity, view:details-record
View: Link
Name: link-details-record
Event: read-details-record
Content: {var:list.row. model-list.field1}
URL and/or URL parameters : this-id={var:liste.row.model-list.list-id}

event read-details-record is a simple event to read a record with id=list-id and display all fields

Enjoy! Chronoengine is a very magic tool!

Salute from France and sorry for my bad english language.
danielparkop 1
May 26 2021, 17:42 #396561
nice post