Get DDM values from SharePoint List in CEWP
<div id="divContainer" ></div>
<script src="jquery-1.11.1.min.js" type="text/javascript"></script>
<script src="SPAPI_Core.js" type="text/javascript"></script>
<script src="SPAPI_Lists.js" type="text/javascript"></script>
<script type="text/javascript">
function getDDMValues() {
var pcSites = new SPAPI_Lists(siteUrl );
var pcList = pcSites.getList(listName);
html = '<table width="100%">';
$(pcList.responseXML).find("Field[DisplayName='Community Type'] CHOICE").each(function () {
var fieldValue = $(this).text();
html = html + '<tr>';
html = html + '<td onclick="getByType(this.innerText);">' + fieldValue + ' <img src="/sites/myparagon/MIX/ImageLibrary/PlayGreen.jpg"
style="height:20px;width:20px;border:none;float:right;" alt=""/></td>';
html = html + '</tr>';
html = html + '<tr><td></td></tr>';
});
html = html + '</table>';
document.getElementById("divContainer").innerHTML = html;
}
</script>
<div id="divContainer" ></div>
<script src="jquery-1.11.1.min.js" type="text/javascript"></script>
<script src="SPAPI_Core.js" type="text/javascript"></script>
<script src="SPAPI_Lists.js" type="text/javascript"></script>
<script type="text/javascript">
function getDDMValues() {
var pcSites = new SPAPI_Lists(siteUrl );
var pcList = pcSites.getList(listName);
html = '<table width="100%">';
$(pcList.responseXML).find("Field[DisplayName='Community Type'] CHOICE").each(function () {
var fieldValue = $(this).text();
html = html + '<tr>';
html = html + '<td onclick="getByType(this.innerText);">' + fieldValue + ' <img src="/sites/myparagon/MIX/ImageLibrary/PlayGreen.jpg"
style="height:20px;width:20px;border:none;float:right;" alt=""/></td>';
html = html + '</tr>';
html = html + '<tr><td></td></tr>';
});
html = html + '</table>';
document.getElementById("divContainer").innerHTML = html;
}
</script>
No comments:
Post a Comment