Sort results
-
Hi
I mostly use the forms for competitors to enter races. Some of our races attract a lot of competitors.
What I would like to do is to allow the results to be sorted either by adding a parameter to the results list shortcode [CP_CALCULATED_FIELDS_FORM_RESULTS_LIST ID=2 ORDER=4 DESC] or ideally, by the user by clicking on the table output column header (Like Tablepress).
-
Hello @mpbaweb
The current version of the plugin does not include this feature by itself, because it give you the possibility to do what you want with the data.
For example, implement the feature you want. It is very simple, but requies an additional library. Assuming the fields in your form are: fieldname1, fieldname2 and fieldname3, and you want call the columns: Column 1, Column 2 and Column 3 (you should replace the columns’ names, as the fields’ names, with the texts you want and the corresponding fields in your form)
Open a page, insert a “HTML Block” (the new WordPress editor includes this block), and then, enter the following piece of code as its content:
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.css"> <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.js"></script> <table id="table_id" class="display"> <thead> <tr> <th>Column 1</th> <th>Column 2</th> <th>Column 3</th> </tr> </thead> <tbody> [CP_CALCULATED_FIELDS_RESULT_LIST formid="1"] <tr> <td><%fieldname1_value%></td> <td><%fieldname2_value%></td> <td><%fieldname3_value%></td> </tr> [/CP_CALCULATED_FIELDS_RESULT_LIST] </tbody> </table> <script> jQuery(function(){jQuery('#table_id').DataTable();}); </script>
and that’s all.
Best regards.That’s brilliant. Thank you so much. Can I make it default to show all rows? 100 should be enough.
Hello @mpbaweb
Please, read the documentation of the
CP_CALCULATED_FIELDS_RESULT_LIST
shortcode, you can use with it thelimit
attribute:https://cff.dwbooster.com/documentation#events-list
Best regards.
Got it. Thanks.
The ‘limit’ parameter does not appear to work. I set it to 100, but it still only shows the first 10. The drop down box works ok, so if I choose 25, it displays 25. But I cannot make it default to show all submissions.
The other thing I would like to do is to make the cell background colour Green if <%payment_status%> is “Paid” and Red if “Not Paid”
Hello @mpbaweb
I’m testing the “limit” attribute in my different copies of the plugin, and it is working properly. Please, ensure there are more than 10 submissions associated to your form, or that the submissions include the fields you are displaying with the shortcode (by the way, if you don’t include include the limit attribute, the shortcode is replaced with all the submissions corresponding to the form)
What is the version number of your copy of the plugin, and what is the structure of the shortcode?
Concerning to your second question.
You can insert into the shortcode, the tag for cell corresponding to the paid status as:
<td class="<%payment_status%>"><%payment_status%></td>
and then in the styles of your website, you can define the background for the selector:
.Paid{background:yellow !important}
or the css rules you want.
I’m sorry, but for questions related with the commercial versions of the plugin, you should create a ticket in my private website:
https://cff.dwbooster.com/contact-us
Best regards.
I am using Version 5.0.309
I originally started without the limit parameter. I implemented the jquery data table, but as soon as we received 11 entries, only 10 showed. I then added the limit=100 parameter but this made no difference at all. The dropdown stayed defaulted to 10. When you change the dropdown to 25 then you can see the other entries.Live Page : https://www.mpba.org.uk/race-hub/multi-ndc-r8-20190907-entries/
Shortcode used : [CP_CALCULATED_FIELDS_RESULT_LIST formid=”17″ limit=”100″]
Hello @mpbaweb
The plugin is loading the 11 entries, but you are using the DataTable library on your thank you page, and the behavior of DataTable is to display a multi-pages table with 10 entries per page, but remember, this module is not part of our plugin, please, watch the video visiting the following link:
[video src="https://wordpress.dwbooster.com/customdownloads/2019/03/21/video.mp4" /]
Best regards.
Can’t get that cell colour css to work either, but that’s probably because I do not know what I am doing with css.
Yes, I watched the video. I was not saying that any entries were missing, I was just saying I want it to default to showing ALL not just the first 10.
That is not the thankyou page by the way – the thankyou page is this:
https://www.mpba.org.uk/race-hub/multi-ndc-r8-20190907-success/Hello @mpbaweb
You are confusing the responsibilities here. As I said in my previous ticket, who restricts the entries per page is the DataTable module, and not our plugin (DataTable is not part of our plugin). There is not relationship between the attributes in the shortcode that generates the tr tags, and the way that DataTable visualizes them.
If you need additional support customizing the behavior of the DataTable, I can offer you custom coding service from my private website:
https://cff.dwbooster.com/customization
Best regards.
I think this can be achieved by inserting data-page-length=’x’
e.g. <table id=”mytable” class=”display” data-page-length=’100′>
Now to try to fix the css cell colouring, but this confuses me.
-
This reply was modified 5 years, 11 months ago by
mpbaweb.
You can find it on your own demo:
https://demos.dwbooster.com/calculated-fields-form/
The multi select field. It′s more a text field with choices, right?
multi select drop down would be more like this here:
https://semantic-ui.com/modules/dropdown.html
Heading: Multi SelectionDo you have plans for a repeatable field group?
-
This reply was modified 5 years, 11 months ago by
- The topic ‘Sort results’ is closed to new replies.