Cascading dropdowns – EXTERNAL LIST

Forums Cascading dropdowns Cascading dropdowns – EXTERNAL LIST

This topic contains 8 replies, has 2 voices, and was last updated by  Alexander Bautz 1 week, 4 days ago.

  • Author
    Posts
  • #9425

    lzuhuo
    Participant

    Hi Alex, I try to config the Cascading dropdowns for an external list, but does not work.

  • #9440

    Alexander Bautz
    Keymaster

    Hi,
    I have actually not used external list myself, but If I remember correctly, it should work if you add a field “ID” to your external list (the “id” column of an external list is not called ID, but the script expects this column).

    Let me know if you manage to get it working.

    Alexander

  • #9551

    lzuhuo
    Participant

    Exacly, I tryed to add a field “ID” in my external list but it does not appears.

  • #9569

    Alexander Bautz
    Keymaster

    I’ll check with someone that I believe have set this up successfully and post back here.

    Alexander

  • #9603

    lzuhuo
    Participant

    No problem.Thanks

  • #9748

    Alexander Bautz
    Keymaster

    Sorry for the delay. I checked with the person who I know have used external lists a lot, and this is his feedback. I hope this will help you.

    I have used external lists a lot.
    Basically this is how they work:

    Lets say you have a table (entity) in SQL database.
    Say “Contacts” and you have ID, First Name, Last Name, Address.
    Now, ID is the identity field (unique field) so that you can uniquely identify a record.

    Using BCS (Business Connectivity Services) in Sharepoint, you can connect to SQL (or any other record source) and link the “Contacts” table, and surface/expose it as a list within Sharepoint.

    During the configuration process, you have option to map the fields. You also have the option to identify the identity/unique columns.

    Other than that, no. you don’t have to add a column that is not originally in the source. All the columns in the External list come from the external source.

    Does that help?

    Gilbert

  • #25271

    lzuhuo
    Participant

    Good morning Alex.
    I would like to use an API as a dataSourceArray in cascading-dropdown solution.
    My API returns an Array, but when I try to use it, this is my console log in attachment.
    This is my code

    
    
    var dataSourceArray;
    $.ajax({
        url:"/api/sp/rfids/permitidos",
        success: function(json) {
            // Do stuff with data
            dataSourceArray = json;
            console.log(dataSourceArray);
        },
        error: function(e) {
           console.log(e);
        }
    });
    
    spjs.casc.init(
        {
        "manualMode":true,
        "dataSource":dataSourceArray,
        "lookupList":"",
        "lookupListBaseUrl":"",
        "lookupListFields":["Title"],
        "thisListFields":["DS_REDE"],
        "dropDownDefaultvalue":"Select...",
        "filter":"",
        "hideEmptyDropdowns":false,
        "autoselectSingleOption":true,
        "clearInvalidSelection":false,
        "addOwnValue":false,
        "addOwnValueMouseover":"",
        "cancelOwnValueMouseover":"",
        "sideBySide":true,
        "debug":false
        }
    );
    Attachments:
  • #25277

    lzuhuo
    Participant

    I find out. The “spjs.casc.init” function must be inside ajax, as it is asynchronous. Has a delay on get API’s reponse.

    My code

    
    
    $.ajax({
        url:"/api/sp/rfids/permitidos",
        success: function(json) {
            spjs.casc.init(
                {
                "manualMode":true,
                "dataSource":json,
                "lookupList":"",
                "lookupListBaseUrl":"",
                "lookupListFields":["NM_FUNCIONARIO"],
                "thisListFields":["DS_REDE"],
                "dropDownDefaultvalue":"Select...",
                "filter":"",
                "hideEmptyDropdowns":false,
                "autoselectSingleOption":true,
                "clearInvalidSelection":false,
                "addOwnValue":false,
                "addOwnValueMouseover":"",
                "cancelOwnValueMouseover":"",
                "sideBySide":true,
                "debug":false
                }
            );
        },
        error: function(e) {
           console.log(e);
        }
    });

You must be logged in to reply to this topic.