sympmarc / SPServices

SPServices is a jQuery library which abstracts SharePoint's Web Services and makes them easier to use. It also includes functions which use the various Web Service operations to provide more useful (and cool) capabilities. It works entirely client side and requires no server install.
MIT License
208 stars 61 forks source link

SPServices.SPCascadeDropdowns - 'All' option? #52

Open jhueschen opened 7 years ago

jhueschen commented 7 years ago

Greetings!

Loving SPServices.SPCascadeDropdowns! It occurs to me that having a function based option for an (all) selection would be useful. Thinking it would be similar to the (All) option automatically created by Excel when filtering. Not sure if it is possible, or already available?

Example State & City columns, State filters City. End form has optional input for State, just requires correct city. User isn't sure what state a particular city is in, so would prefer to scroll through the entire list of possible cities. Can select (All) to view all cities and State returns null/blank (or the correct lookup value for the city, which would be even better!)

sympmarc commented 7 years ago

Glad you're loving SPCascadeDropdowns! I think the scenario you describe is basically what you get if you don't call SPCascadeDropdowns at all. The issue becomes one of differentiation between potentially identical values.

I know your example is contrived, but consider the fact that there is a Springfield in every state. If you don't have the cascading, there's no way to know which is the correct value.

I'm thinking a better approach would be to conditionally allow the end user to "turn off" cascading. In many cases, we won't allow that, but in your example you would want to. Does that make sense?

jhueschen commented 7 years ago

Yes that makes perfect sense, I had not thought about the identical situation. Regarding conditionally allowing the user to turn off cascading, do you think that is something I could program into the form Javascript or would that need to be done at a higher level (your source, etc)?

sympmarc commented 7 years ago

@jhueschen Right now, there's no way to "turn off" cascading once you've instantiated it, unfortunately. You could allow them to conditionally turn it on, though, by giving them something in the UI to do so.