Jump to content

Issue with Page List Select Multiple


Sylvio
 Share

Recommended Posts

I installed the Page List Select Mutiple module, created a field of type page, Mutiple Pages(PageArray)

but in the 'Input field type' dropdown I don't see the option 'PageListSelectMultiple', I only see

the 'PageListSelect'?

Link to comment
Share on other sites

For some reason I don't have this enabled by default. But here's how you do it:

1. Go to 'Admin > Modules' and make sure that the 'Inputfield > PageListSelectMultiple' module is installed.

2. While still in 'Admin > Modules', click on 'Inputfield > Page' and add 'PageListSelectMultiple' to the list of allowed Inputfields. Save.

3. Edit your Page field and change the Inputfield to the one you just added. Save.

Let me know if that does it?

How else do I "relate" the distributors with their projects and the products used in those projects, etc...

The PageListSelectMultiple Inputfield is great for two situations:

1. Where you want to be able to select from multiple pages that may live at different parts in the tree hierarchy. This Inputfield can traverse the tree hierarchy just like PW's PageList.

2. Where the number of selectable options is too much to be reasonable for use with checkboxes or asmSelect. This Inputfield supports pagination of selectable options, just like PW's PageList.

The place where I use it most often is in my homepage template where I want to be able to select a few "featured" pages on the site, and I want to be able to select any page, anywhere in the site. I couldn't do this in a scalable manner with any other inputfield. The only other way to accomplish it is to add a "featured" checkbox to all my page templates, and $pages->find('featured=1') to get them (which also isn't a bad solution).

The situation you described makes me wonder if this is the best inputfield, because you only need to support two different types (distributors and products in your projects template), and your code will have to differentiate between the two in your template. Assuming you select a single 'distributor' and multiple 'products', and that product pages are children of distributor pages,  an alternate approach might be to split it in two fields that are in your 'projects' template:

- distributor: Page (single using select)

- products: Page (multiple using asmSelect)

The parent page for the 'distributor' field settings would be '/distributors/' or whatever it is in your site.

For the 'products' field, you would use the "Alternate/custom code to find selectable pages" option in the field settings. And you'd paste in something like this:

return $page->distributor ? $page->distributor->children() : new PageArray(); 

That basically says to return the distributor's children as selectable pages if there is a distributor. Otherwise, return a blank PageArray.

Not sure if this is totally applicable to your needs, but just wanted to provide it as an example of what the "alternate/custom code..." option does, just in case it does suite your needs better.

Link to comment
Share on other sites

Ryan, it worked...

But I think I need to use 'PageListSelectMultiple' Inputfield, I wasn't clear in my explanation.

A project  can have one or multiple related distributors, there are about 30 disitributors, every distributor resides under a tree node 'distributors', so for this I used the 'AsmSelect' Inputfield.

From a distributor detail page, there can be one or multiple projects related, projects resides under a tree node 'projects', grouped under multiple categories tree nodes. Projects can be hundreds.... So to my guess PageListSelectMultiple is the best option here, cause I need to traverse the projects tree, correct?

Also from a product page to related projects, same thing, traversing projects -> PageListSelectMultiple

Cheers

Link to comment
Share on other sites

Glad that worked!

It does sound like the PageListSelectMultiple is the right choice for your needs. If it needs to traverse a tree and there are hundreds of possible options, then this is the best bet. We'll also be adding an autocomplete page selection fieldtype at some point, which could be useful here as well.

Link to comment
Share on other sites

  • 4 months later...

I'm playing with this input type recently, and it gets cumbersome to use, when each time I select a page the tree closes. If I want to select some pages from a certain branch, I need to repeat to open the same over and over again. Would be nice if it's possible that the tree stays open when adding pages.

Link to comment
Share on other sites

If you need to select a lot of pages, you are right that it's cumbersome. But I had to design this field to maximize the simplicity with my clients. So the instant feedback of closing the list, showing you what was added and letting you sort right there was the preferable compromise. At least for the needs of the clients I work with. Eventually we'll make the behavior configurable where you can tailor it more to the needs of fields where you might have a lot to select.

Link to comment
Share on other sites

  • 1 year later...

I'm using this fieldtype to assign some users access on a per-page basis (something I have occasionally seen a need for in other topics here on the forums) and agree with Soma that it would be good to be able to keep the tree open after selecting an item.

Does anyone have any idea how to do this? I looked at the JS file for the module but couldn't see anything obvious in there unfortunately.

Is there a simple way to prevent it collapsing automatically using some JS?

Link to comment
Share on other sites

  • 1 year later...

I'm using this fieldtype to assign some users access on a per-page basis (something I have occasionally seen a need for in other topics here on the forums) and agree with Soma that it would be good to be able to keep the tree open after selecting an item.

Does anyone have any idea how to do this? I looked at the JS file for the module but couldn't see anything obvious in there unfortunately.

Is there a simple way to prevent it collapsing automatically using some JS?

I'm wondering if anyone ever solved this? Still searching the forums...

Link to comment
Share on other sites

  • 3 weeks later...

From what I understand of how the select script works that one would most likely have to fairly seriously hack some core files in order to change the functionality of this module. If you are capable of making these changes well then I would suggest creating a whole new module so that you would be able to reuse your code easily and not have to worry when a new version is released. Other than that we just have to just make another polite request to the amazing creator of this fantastic project.

Well I have to chime in though and say I would love to see some new options in the multiselect module. I have a site that I have handed off partially to my client. The pages rely heavily on this module to allow for art directors the ability to hand curate the content in the section. Some sections end up being quite large with many items from various areas of the site tree.

What I envision is the same tree view but instead of the item being immediately added, the item would be checked (and / or) highlighted. A list of these items would display at either the top or bottom of the tree along with an add button. When the user adds the items the list collapses and the items are appended.

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...