Home › Forums › Cascading dropdowns › Using dataSource in Cascading dropdowns
- This topic has 8 replies, 2 voices, and was last updated 3 years, 3 months ago by Alexander Bautz.
-
AuthorPosts
-
-
September 9, 2021 at 18:10 #34461
Hi Alexander,
I’m trying to use dataSource as described in the cascading dropdown documentation but I’m having problems.
Code that works (not using dataSource):
spjs.casc.init( { "manualMode":true, "dataSource":"", "lookupList":"ListName", "lookupListFields":["Title","Field1","Field2","Field3"], "thisListFields":['TitleField','thislistField1:multi','thislistField2:multi','thislistField3:multi'], "setFields":[], "dropDownDefaultvalue":"Select...", "filter":"", "hideEmptyDropdowns":false, "autoselectSingleOption":true, "clearInvalidSelection":false, "addOwnValue":false, "addOwnValueMouseover":"", "cancelOwnValueMouseover":"", "sideBySide":true, "multichoiceDelimiter": ";" + String.fromCharCode(13, 10), // this represents a semicolon and a linefeed "debug":false } );
Code that doesn’t work (trying to use dataSource):
var res = spjs.utility.queryItems( { "listName":"ListName", "query": "<Where><Contains><FieldRef Name='QueryField'/><Value Type='Text'>QueryValue</Value></Contains></Where>", "viewFields":["Title","Field1","Field2","Field3"] } ); var dataSourceArray = res.items; spjs.casc.init({ "manualMode":true, "dataSource":dataSourceArray, "lookupListFields":["Title","Field1","Field2","Field3"], "thisListFields":['TitleField','thislistField1:multi','thislistField2:multi','thislistField3:multi'], "hideEmptyDropdowns":false, "autoselectSingleOption":true, "clearInvalidSelection":false, "addOwnValue":false, "addOwnValueMouseover":"", "cancelOwnValueMouseover":"", "sideBySide":true, "multichoiceDelimiter": ";" + String.fromCharCode(13, 10), // this represents a semicolon and a linefeed "debug":false });
-
September 9, 2021 at 19:51 #34466
Hi,
I guess your example code is just that and you are not using ListName, QueryField and QueryValue?Try opening the developer console and type in this in the console:
dataSourceArray
This should show you the array of objects – does it contain any items?
Alexander
-
September 10, 2021 at 00:34 #34471
That is correct. Yes, an array of 4 objects is contained in dataSourceArray
-
September 10, 2021 at 00:52 #34473
Even if I manually create an array of objects and try to pass that variable into dataSource, it still does not work:
Broken code:
var dataArray = [ { "Title":"Item #1", "Field1":"some value", "Field2" : "20" }, { "Title":"Item #2", "Field1":"another value", "Field2" : "30", } ] spjs.casc.init( { "manualMode":true, "dataSource":dataArray, "lookupListFields":["Title","Field1","Field2"], "thisListFields":['FIN1','FIN2','FIN3'], "hideEmptyDropdowns":false, "autoselectSingleOption":true, "clearInvalidSelection":false, "addOwnValue":false, "addOwnValueMouseover":"", "cancelOwnValueMouseover":"", "sideBySide":true, "multichoiceDelimiter": ";" + String.fromCharCode(13, 10), // this represents a semicolon and a linefeed "debug":false } );
- This reply was modified 3 years, 3 months ago by Mitchell T.
-
September 10, 2021 at 15:40 #34478
OK, what is happening when you load the form? – is the dropdown just empty or do you get any error messages in the developer console (hit F12 > Console)?
Alexander
-
September 10, 2021 at 19:20 #34480
The dropdowns just spin like they are loading but never load. No error messages.
-
September 11, 2021 at 09:27 #34482
I have confirmed this bug and have fixed it in the attached file. Unzip it and replace the file in your /SPJS/DFFS/plugins folder.
If you use DFFS installer v2 you should go to the installer and hit the Update loader file button in the first tab to ensure the browser loads the new version of the script file and not the old one from the browser cache.
You don’t need to reinstall any of your forms – just hit the Update loader file button.
Let me know how this works out.
Alexander
Attachments:
-
-
September 13, 2021 at 21:57 #34488
That worked! Thank you much
-
September 14, 2021 at 22:19 #34501
Thanks for the feedback, I’ll include this fix in the next release.
Alexander
-
-
-
AuthorPosts
- You must be logged in to reply to this topic.