Jump to content
netcarver

AsmSelect + PageField Modify Selected Options Order In Select Dropdown

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?

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...