Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all articles
Browse latest Browse all 6517

Commented Issue: Possible bug in SPComplexToSimpleDropdown [10267]

$
0
0
From: https://spservices.codeplex.com/discussions/549462

I see what you are saying. genContainerId isn't respecting the listName that you've passed in. BUG!

I think this will fix it:
``` javascript
// Generate a unique id for a containing div using the function name and the column display name
function genContainerId(funcname, columnName, listName) {
var l = listName !== undefined ? listName : $().SPServices.SPListNameFromUrl();
return funcname + "_" + $().SPServices.SPGetStaticFromDisplay({
listName: l,
columnDisplayName: columnName
});
} // End of function genContainerId
```
and changing the call to SPComplexToSimpleDropdown like this:
``` javascript
// If requested and the childColumn is a complex dropdown, convert to a simple dropdown
if (opt.simpleChild === true && childSelect.Type === dropdownType.complex) {
$().SPServices.SPComplexToSimpleDropdown({
listName: opt.listName,
columnName: opt.childColumn
});
```
and then picking up the listName in SPComplexToSimpleDropdown:
``` javascript
// function to convert complex dropdowns to simple dropdowns
$.fn.SPServices.SPComplexToSimpleDropdown = function(options) {

var opt = $.extend({}, {
listName: $().SPServices.SPListNameFromUrl(), // The list the form is working with. This is useful if the form is not in the list context.
columnName: "", // The display name of the column in the form
completefunc: null, // Function to call on completion of rendering the change.
debug: false // If true, show error messages;if false, run silent
}, options);

...

// Build up the simple dropdown, giving it an easy to select id
var simpleSelectId = genContainerId("SPComplexToSimpleDropdown", opt.columnName, opt.listName);
...
```

While I'm at it, I'm adding listName as an option to SPComplexToSimpleDropdown, SPDisplayRelatedInfo, SPFilterDropdown, SPAutocomplete, and SPSetMultiSelectSizes.
M.
Comments: Fixed in 2014.01ALPHA1

Viewing all articles
Browse latest Browse all 6517

Trending Articles