If you want to transpose the vLookup table and have each field value on a separate line – like the default SharePoint form – you can add this snippet to your Custom JS. Please change YOUR_VLOOKUP_FIELD with the name of your vLookup column:
function transpose_vLookupTable(fin) {
var itemId = spjs.dffs.data.isNewForm ? spjs.dffs.data._DFFSID : spjs.dffs.data.thisItemID, b = [], path = _spPageContextInfo.webServerRelativeUrl + "/_layouts/15/listform.aspx?PageType=4&ListId="+spjs.vLookup.data.blob[fin].listName+"&ID=";
b.push("<tr><td colspan='2'><img onclick='spjs.vLookup._init(\""+fin+"\",false,true);' src='"+spjs.vLookup.data.reloadImg+"' style='margin-top:5px;cursor:pointer;'></td></tr>");
jQuery.each(spjs.vLookup.dataObj[fin][itemId].items, function (i, item) {
b.push("<tr><td colspan='2'><hr /></td></tr>");
b.push("<tr>");
b.push("<td style='font-weight:bold;padding:2px 5px;'>ID</td>");
b.push("<td style='padding:2px 5px;'><a style='cursor:pointer;' onclick='spjs.vLookup.openInDialog(\""+path+item.ID+"\",\""+fin+"\",false);'>" + item.ID + "</td>");
b.push("</tr>");
jQuery.each(spjs.vLookup.dataObj[fin][itemId].fields, function (fin, disp) {
b.push("<tr>");
b.push("<td style='font-weight:bold;padding:2px 5px;width:200px;'>" + disp + "</td>");
b.push("<td style='padding:2px 5px;'>" + item[fin] + "</td>");
b.push("</tr>");
});
});
jQuery("#vLookup_" + fin + "_" + itemId).html(b.join(""));
}
function vLookupIsLoadedCallback(fin){
if(fin === "YOUR_VLOOKUP_FIELD"){
transpose_vLookupTable(fin);
}
}
Please note that this is a basic code example and you must style your new table to the layout you like.
Alexander