Using dataSource in Cascading dropdowns

Home Forums Cascading dropdowns Using dataSource in Cascading dropdowns

Viewing 5 reply threads
  • Author
    Posts
    • #34461
      Mitchell T
      Participant

        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
        });
      • #34466
        Alexander Bautz
        Keymaster

          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

        • #34471
          Mitchell T
          Participant

            That is correct. Yes, an array of 4 objects is contained in dataSourceArray

          • #34473
            Mitchell T
            Participant

              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, 1 month ago by Mitchell T.
              • #34478
                Alexander Bautz
                Keymaster

                  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

              • #34480
                Mitchell T
                Participant

                  The dropdowns just spin like they are loading but never load. No error messages.

                  • #34482
                    Alexander Bautz
                    Keymaster

                      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:
                  • #34488
                    Mitchell T
                    Participant

                      That worked! Thank you much

                      • #34501
                        Alexander Bautz
                        Keymaster

                          Thanks for the feedback, I’ll include this fix in the next release.

                          Alexander

                    Viewing 5 reply threads
                    • You must be logged in to reply to this topic.