Forums

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

Colnem 23 Feb, 2021
Answer
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
{session.set:keyword1}
{session.set:keyword2}
{session.set:keyword3}
{session.set:keyword4}

{fn:check-startat-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

{event:list}
step 2: Chronoconnectivity6, event list

{fn:check-startat-empty}


{view:formarea-filters}
Data provider:{session:}
Submit Event:filters
Content:{chronoform.section:form-filters}


{fn:read-my-table}
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
record-id
text-field1
text field2
numeric-field3
dropdown-field4
field5
field6


{view:paginator-list}

table: list
{view: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:
name=keyword4
Options:
=All values
value1=label1
value2=label2
value2=label3
value2=label4
value2=label5
value2=label6
Options (alternative code:
=All values
{var:an-array})
Selected value: {session:keyword4}

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


{fn:raz-startat}


{session.set:keyword1$(data:keyword1)}
{session.set:keyword2$(data:keyword2)}
{session.set:keyword3$(data:keyword3)}
{session.set:keyword4$(data:keyword4)}


{redirect:list}
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.
Elita- 19 Oct, 2023
Hi, Colnem,
Could you, please, explain here this:
>>>>>>>> Builder raz-startat: Type=Data, Name=startat, Value=0 <<<<<<<<<<<<<

I cannot figure this out. Should I use DataBuilder2? how can I build those values with that?
Or is that PHP function?
Thanks!

Elita
Colnem 21 Oct, 2023
Hi

This is an old form, using CF6 and CC6.
Now, I do that under CF7.

Friendly
Elita- 21 Oct, 2023
Good for you. I am still using good old CF6 and CCv6, so I wanted to know. I understand everything you wrote except this.
In CCv6 - Where do you build that raz-startat: Type=Data, Name=startat, Value=0? In DataBuider? How?
Elita
Colnem 22 Oct, 2023
Hi
Sorry but I don't remember very well and I don't have any site with CCv6.
This should be a Data Builder somewhere. Search in CCV6 tools...

Good luck!
Elita- 22 Oct, 2023
Dont bother. I figured it myself. Thank you for your kind responsiveness. Good luck!
You need to login to be able to post a reply.