Now it's working :)
The problem now is that I have a list called 'Lista Diccionario'
and I want to get all the items there.
"There's the code" but it doesn't work.
look:
var _listName = "Lista Diccionario";
var _listDiccionario;
$(document).ready(function()
{
//_spBodyOnLoadFunctionNames.push("Initialize()");
ExecuteOrDelayUntilScriptLoaded(initialize, "sp.js");
//getList();
//addToolTipToList("body","0000FF",_listDiccionario);
});
function initialize(){
getList();
}
function addToolTipToList(where, color, list){
for( i=0 ; i < list.length ; i++){
addTooltipToText("body", "0000FF", list[i][0], list[i][1]);
}
}
function addTooltipToText(where, color, text, tooltipMessage) {
$(where).replaceEachOne(text, '<label style="color:#'+ color + ';" title="' + tooltipMessage + '">$1</label>');
}
//Ejemplo en http://sharepointbloggin.com/2010/02/10/walkthrough-4-accessing-list-data-using-the-javascript-client-om/
function getList(){
//_listDiccionario = Array(new Array("elemento","Este es el mensaje"), new Array("mensaje","cosas rarascosas ")); //Para probar
var ctx = new SP.ClientContext.get_current();
this.web = ctx.get_web();
ctx.load(this.web);
/*var webUrl = "http://c-jfmunoz:5000";
var context = new ClientContext(webUrl); */
// Get references to the lists we will use
var listObject = web.get_lists().getByTitle(_listName);
ctx.load(listObject);
// Get the list items for the list
_listDiccionario = listObject.getItems();
// context.load tells the object model to load the objects scalar
// properties. Otherwise they will not be accessible
ctx.load(_listDiccionario);
ctx.executeQueryAsync(Function.createDelegate(this, this.onListsLoaded),
Function.createDelegate(this, this.onListsFailed));
}
/*
Event handler called loading the contacts and companies lists
This method dynamically renders an HTML table to display the list data
*/
function onListsLoaded(sender, arg) {
addToolTipToList("body","0000FF",_listDiccionario);
return false;
}
function onListsFailed(sender, args) {
alert('failed to update title. Error:'+args.get_message());
return false;
}