var myColl="";
function BindLinksData()
{
try
{
var context = new SP.ClientContext.get_current();
var web = context.get_web();
var list = web.get_lists().getByTitle('Links');
var sQuery="<View><Query><OrderBy><FieldRef Name='ID' /></OrderBy></Query></View>";
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml(sQuery);
this.myColl = list.getItems(camlQuery);
context.load(this.myColl, 'Include(URL)');
context.executeQueryAsync(Function.createDelegate(this, this.BindLinksDataSuccess), Function.createDelegate(this, this.BindLinksDataFailed));
}
catch(Ex)
{
alert(Ex);
}
}
function BindLinksDataSuccess()
{
var strLinksData="";
strLinksData+="<Table>";
if(myColl.get_count()!=0)
{
var listEnumerator = this.myColl.getEnumerator();
strLinksData+="<Tr>";
strLinksData+="<Td Align='Center' class='HeadingClass'>";
strLinksData+="Getting Data From Links List";
strLinksData+="</Td>";
strLinksData+="</Tr>";
strLinksData+="<Tr>";
strLinksData+="<Td class='HeadingClass'>";
strLinksData+="Link Name";
strLinksData+="</Td>";
strLinksData+="</Tr>";
while (listEnumerator.moveNext())
{
var item = listEnumerator.get_current();
var strLinkUrl=item.get_item('URL').get_url();
var strLinkTitle=item.get_item('URL').get_description();
strLinksData+="<Tr>";
strLinksData+="<Td class='LoopRecordsClass'>";
strLinksData+="<A href='"+strLinkUrl+"' class='LoopRecordsClass'>"+strLinkTitle+"</a>";
strLinksData+="</Td>";
strLinksData+="</Tr>";
}
}
else
{
strLinksData+="<Tr>";
strLinksData+="<Td Colspan='2' Align='Center' class='HeadingClass'>";
strLinksData+="No Books Data Available";
strLinksData+="</Td>";
strLinksData+="</Tr>";
}
strLinksData+="</Table>";
document.getElementById("tdLinks").innerHTML=strLinksData;
}
function BindLinksDataFailed(sender, args)
{
alert('failed. Message:' + args.get_message());
}
function BindData()
{
ExecuteOrDelayUntilScriptLoaded(BindLinksData, "sp.js");
}
_spBodyOnLoadFunctionNames.push("BindData");
function BindLinksData()
{
try
{
var context = new SP.ClientContext.get_current();
var web = context.get_web();
var list = web.get_lists().getByTitle('Links');
var sQuery="<View><Query><OrderBy><FieldRef Name='ID' /></OrderBy></Query></View>";
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml(sQuery);
this.myColl = list.getItems(camlQuery);
context.load(this.myColl, 'Include(URL)');
context.executeQueryAsync(Function.createDelegate(this, this.BindLinksDataSuccess), Function.createDelegate(this, this.BindLinksDataFailed));
}
catch(Ex)
{
alert(Ex);
}
}
function BindLinksDataSuccess()
{
var strLinksData="";
strLinksData+="<Table>";
if(myColl.get_count()!=0)
{
var listEnumerator = this.myColl.getEnumerator();
strLinksData+="<Tr>";
strLinksData+="<Td Align='Center' class='HeadingClass'>";
strLinksData+="Getting Data From Links List";
strLinksData+="</Td>";
strLinksData+="</Tr>";
strLinksData+="<Tr>";
strLinksData+="<Td class='HeadingClass'>";
strLinksData+="Link Name";
strLinksData+="</Td>";
strLinksData+="</Tr>";
while (listEnumerator.moveNext())
{
var item = listEnumerator.get_current();
var strLinkUrl=item.get_item('URL').get_url();
var strLinkTitle=item.get_item('URL').get_description();
strLinksData+="<Tr>";
strLinksData+="<Td class='LoopRecordsClass'>";
strLinksData+="<A href='"+strLinkUrl+"' class='LoopRecordsClass'>"+strLinkTitle+"</a>";
strLinksData+="</Td>";
strLinksData+="</Tr>";
}
}
else
{
strLinksData+="<Tr>";
strLinksData+="<Td Colspan='2' Align='Center' class='HeadingClass'>";
strLinksData+="No Books Data Available";
strLinksData+="</Td>";
strLinksData+="</Tr>";
}
strLinksData+="</Table>";
document.getElementById("tdLinks").innerHTML=strLinksData;
}
function BindLinksDataFailed(sender, args)
{
alert('failed. Message:' + args.get_message());
}
function BindData()
{
ExecuteOrDelayUntilScriptLoaded(BindLinksData, "sp.js");
}
_spBodyOnLoadFunctionNames.push("BindData");
No comments:
Post a Comment