• Resolved skscomp

    (@skscomp)


    I created a drop down for taxonomy
    now it sorts entries by term_id
    I can sort entries alphabetically
    or for example sort by slug number (I will assign a number to slug)

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @skscomp ,

    Thank you very much for using our plugin. You have two alternatives, you can read the taxonomy terms by using the Database data-source, and including an ORDER BY clause in the query, or you can include a callback in the recordset field to sort the results in the client side after receive them as you prefer.

    Please try the following example.

    Create a form and enter the following structure:

    <script>function my_sort(data){
    data.sort((a,b)=>a.slug<b.slug?-1:(a.slug == b.slug ? 0 : 1));
    return data;
    }</script>
    [select my_list]
    [cf7-recordset id="my_recordset" type="taxonomy" taxonomy="category" attributes="term_id,name,slug" callback="my_sort"]
    [cf7-link-field recordset="my_recordset" field="my_list" value="term_id" text="slug"]

    The recordset field includes the callback attribute callback="my_sort" it takes the recordset records and sorts them by the slug term. The rest of the fields’ tags have the usual structure.

    Best regards.

    Thread Starter skscomp

    (@skscomp)

    you have a good plugin, but you should make the sorting easier.

    Thread Starter skscomp

    (@skscomp)

    Thanks for your help, everything worked out

    Plugin Author codepeople

    (@codepeople)

    Hello @skscomp

    Thank you very much for the suggestions.

    Best regards.

    Plugin Author codepeople

    (@codepeople)

    Hello @skscomp

    Today, we released an update for the plugin that enables users to easily sort records by including order_by attributes in the RecordSet tags.

    The form’s structure I sent you in a previous entry can be modified as follows in the latest plugin update:


    [select my_list]
    [cf7-recordset id="my_recordset" type="taxonomy" taxonomy="category" attributes="term_id,name,slug" order_by="slug"]
    [cf7-link-field recordset="my_recordset" field="my_list" value="term_id" text="slug"]

    Please purge the website and browser caches after installing the plugin update.

    Best regards.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.