Custom Fields
Re-Envisioned
Support General Select2 Library

  • Creator
    Topic
  • #15222
    VESELIN ANGELOV
    Participant

    Hello,

    I use select_advanced option to show custom posts, my question is:
    Is there a some way to integrate “Select2 Drag and Drop Sorting” as described here:
    https://select2.github.io/select2/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • #17969
    Austin Passy
    Participant

    I don’t think it’s possible since multiple selections get saved into the db a non unique value that isn’t indexed. The only real option is a group of selections which you may run into other issues.

    #17978
    Austin Passy
    Participant

    In an ideal would it should be simple to add this to the select advanced field type. If an attribute like sortable => true was set along with multiple => true, then the meta data saved would be non-unique and would solve this issue. Then this simple solution (along with enqueuing jquery-ui-sortable) https://github.com/select2/select2/issues/3004#issuecomment-149379355 would allow for these fields to be sortable.

    This would be an awesome feature.

    #17987
    Anh Tran
    Keymaster

    We have switched to select4 and it doesn’t support this feature anymore. There is some workaround here and the confirmation from the author.

    #18002
    Austin Passy
    Participant

    While that works from the sorting perspective, the fact that the data when set to multiple is saved as unique doesn’t work. Quickly playing around with the core meta.php files for how data for field types are set. When I forced a multiple advanced selector to single=true data was in fact saved into an array which would of course allow for sorting. I didn’t have additional time to play with the JS to force the new index arrays, but I assume it would be close to the way the clone order reindex works.

    Seems more plausible to create a new custom field type to get this done (if I ever find the time or the business needs really require it over cloned select fields (which could get very messy with 40+ clones)).

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

Newsletter

Subscribe to our newsletter to receive news and tutorials for Meta Box and WordPress.


grid gear info copy caret-up caret-down trash