Skip Navigation

[Resolved] Select2 drop down. List length and order

This support ticket is created 3 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 2 replies, has 2 voices.

Last updated by leeL 3 years, 5 months ago.

Assisted by: Minesh.

Author
Posts
#2279351
Screenshot 2022-01-30 at 14.26.41.png

I have successfully created a relationship form between two posts. This is where a user can create their own lists to which they then can add words from the dictionary. I have successfully all working on the front-end.

The part I would like some guidance on is the select2 dropdown. See attached screen print, is there some custom code I can add that will put the list in ascending order and also allow me to state, how many words show in the list.

Thanks
Lee

#2279795

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

As stated with our Docs, you can use the attribute order to order by ASC or DESC.

order. Optional. Can take values of ASC and DESC. DESC is the default value. Defines the direction for the post oreder being offered in this role selector.

=> https://toolset.com/documentation/programmer-reference/forms/cred-shortcodes/#cred-relationship-role

It also offers the orderby attribute.
orderby. Optional. Can take the values of date, title or ID. ID is the default value. It will decide the order of the posts being offered in this role selector.

Regarding controlling the number of options, we do not any any API filter to change the number of options/posts displayed with select2 at the moment but we do already filed the feature request and I've added your voice to our internal ticket.

#2280161

My issue is resolved now. Thank you!