2

I'm on Sharepoint foundation 2013.

I have a external list (based on a WCF)

For the new and edit form, I'd like to have some columns to be a dropdown (list of selections to be populated from another WCF)

Is JSlink the only option? (seems like there will be lots muck around using JSLink) Not sure if there are other solutions that's cleaner and simpler? (e.g. SP Designer etc)

Thanks!!!

1 Answer 1

1

For now, I using the following solution:

Do the callback for render field:

context.Templates.Fields["FieldName"] = { "View": callback};

Then render the SELECT control:

function callback(ctx){
    var items = new Array("2", "123", "1", "4634"); //This list can come from a WCF, (you can use JQuery)
    var returnHtml = "<div id=" + ctx.CurrentFieldSchema.Name + "><select>";

    for (var i = 0; i < items.length; i++) {
        returnHtml += "<option";
        if (ctx.CurrentFieldValue == items[i]) {
            returnHtml += " selected ";
        }
        returnHtml += ">" + items[i] + "</option>";
    }
    returnHtml += "</select></div>";
    return returnHtml;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.