Skip to content

Instantly share code, notes, and snippets.

@c4milo
Created September 23, 2009 02:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c4milo/191625 to your computer and use it in GitHub Desktop.
Save c4milo/191625 to your computer and use it in GitHub Desktop.
Liferay.PEC = Liferay.PEC || {}
Liferay.PEC.Search.Viewer = new Liferay.Class( {
initialize : function(portletns) {
var instance = this;
instance.portletns = portletns;
alert(instance.portletns);
//Necesario para recibir los resultados obtenidos por el portlet
//de búsqueda
Liferay.bind('search_results', this._showResults);
},
_showResults: function (event, data) {
var instance = this;
var portletns = instance.portletns;
alert(instance.portletns);
if(data.header.numberOfResults < 1) {
//No se encontraron resultados
return;
}
jQuery.each(data.resultsByContentType, function(index, contentType) {
//construir tabs y asignar id's
jQuery.each(contentType, function(docType, docsFound){
//alert(docType +" = "+docsFound);
alert(portletns + '1');
jQuery('#'+portletns+'sortable').append("<li><a href=#" + portletns + docType + ">" + Liferay.Language.get(docType) + "</a></li>");
jQuery('#'+portletns+'sortable').after("<div id="+ portletns + docType +"></div>");
});
});
//Por cada set de resultados de tipos de contenido
jQuery(data.resultList).each(function() {
jQuery(this.docs).each(function() {
});
});
//Creando tabs y aplicando stilos
jQuery('#' + portletns + 'result').tabs( {
selected : 0
});
jQuery('#' + portletns + 'sortable').sortable( {
axis : 'x'
});
jQuery('#' + portletns + 'result').tabs('paging', {
cycle : true,
follow : true
}).removeAttr('style');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment