Jump to content

AsmSelect + PageField Modify Selected Options Order In Select Dropdown


netcarver
 Share

Recommended Posts

Hey everyone,

I'd like to be able to mod InputfieldAsmSelect a little with what seems like a simple mod but I've been hitting a wall with it.

What I want to do is simply stop the pre-selected options from appearing at the bottom of the Asm select dropdown and instead have them appear in their natural place in the list.

So, instead of this (with selected moved out-of-order to the end)...

post-465-0-38090000-1412799218_thumb.png

... I want this (with selected items in their original position)...

post-465-0-48669100-1412799219_thumb.png

I know that when I select or deselect an option - without saving the form - the item stays in its initial, correct, position. But once I save the form, all the selected items seem to be sorted to the foot of the select dropdown - so I assume that this is something to do either with the initialisation of the field in its js file or perhaps with the code thats generating the initial data to fill the list... but I can't seem to work out where this happens.

Can anyone provide me with a clue?

Link to comment
Share on other sites

After a nights sleep I've figured it out. It was indeed the rendering of the options in the underlying select that was the issue. Commenting out lines 57-64 of InputfieldAsmSelect ___render() fixes it for me. I'll now hook that method to provide my own implementation that doesn't put all the selected options at the end.

Hope that helps and thanks for looking  :)

  • Like 2
Link to comment
Share on other sites

  • 4 months later...

Hi Steve,

Would you be able to share some code how you went about this? Thanks. I am trying to add extra html inputs to the <span></span> that wrap selected asmSelect values. However, not sure this would work in an asmSelect that is called as an input in a Process Module? Have never really understood Hooks comprehensively...

Edit

Or maybe I should just extend the InputfieldAsmSelectmodule and use my modified jquery.asmselect.js...Any other ideas welcome, thanks..

Edit 2:

No, I think hooking into the Class is better/cleaner in this instance..

Edited by kongondo
  • Like 1
Link to comment
Share on other sites

  • 4 years later...

Hey folks!
For a project  I am working on, I use the nice Image Marker Module.
This Module uses AsmSelect, to add the markers. Each marker is a page.
Now I need the AsmSelect to use the same order as the page tree.
In the dropdown list the order is fine, but when I add a new page/marker it gets added at the bottom.

Iam not experienced with hooks and I could not find the line in the AsmSelect Module netcarver described.
Can someone point me in the right direction?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...