)
{
Application application = FacesContext.getCurrentInstance().getApplication();
UIDataTable htmlDataTable = (UIDataTable) application.createComponent(UIDataTable.COMPONENT_TYPE);
htmlDataTable.setId(componentID);
htmlDataTable.setVar("item");
htmlDataTable.setRows(numRows);
htmlDataTable.setRowClasses("odd-row,even-row"); // MOLT IMPORTANT SI VOLEM APLICAR EL PLUGIN TABLESORTER
// SINO , odd-row,even-row
htmlDataTable.setStyleClass("stable"); // DE JQUERY !!!!!!!!!!!!!!!!!!!!
// stable
htmlDataTable.setIterationStatusVar("it");
htmlDataTable.setRowKeyVar("#{item}");
/////////////htmlDataTable.setStyle(style);
//htmlDataTable.setOnrowmouseover("function(){jQuery(this).children('#solicitantsInmoble').fadeIn('fast')};");
//htmlDataTable.setOnrowmouseout("this.style.backgroundColor='#{a4jSkin.rowBackgroundColor}';");
htmlDataTable.setTransient(true);
htmlDataTable.setValueExpression("value", (ValueExpression) Utils.resolveExpression(valueExpression));
// afegim la referencia/id de l'inmoble
htmlDataTable.getChildren().add(buildColumnID(1L ,
"#{item.idInmoble}",
"ID",
"VCHR",
"ITXT",
false,
"color:black;background:gray;"));
// Columnes datatable segons la Hashtable columnesVisibles de visibilitats
Set<Long> idsColumnes = columnesVisibles.keySet();
Iterator<Caracteristiques> caracteristiquesIter = lc.iterator();
while (caracteristiquesIter.hasNext())
{
Caracteristiques caracteristica = (Caracteristiques) caracteristiquesIter.next();
UIColumn columna = buildColumn(
caracteristica.getCaracteristicaKey() ,
"#{item.caractInmobles[" + caracteristica.getCaracteristicaKey() + "]}",
"#{inmobleForm.columnesVisibles[" + caracteristica.getNom() + "]}",
caracteristica.getNom(),
caracteristica.getTtpbasic().getBdtype(),
caracteristica.getTtpcontrol().getTipus(),
0, // minim nombre digits o chars
caracteristica.getTamanyControl() == null ? 0 : caracteristica.getTamanyControl().intValue(), // maxim nombre digits o chars
caracteristica.isModificable(),
new ArrayList<String>(){/**
*
*/
private static final long serialVersionUID = 1L;
{add(componentID);}},
new ArrayList<String>(){/**
*
*/
private static final long serialVersionUID = 1L;
{add("@this");}});
htmlDataTable.getChildren().add(columna);
}
/*-----------------------------------------------*/
/* afegim (si cal) la columna amb butons/links */
/*-----------------------------------------------*/
htmlDataTable.getChildren().add(buildColumnAmbLink(1L,
"solicitud",
"headerTextValue",
"#{inmobleForm.solicitarInmobles}",
1,
true,
null,
"/images/bSelectNR.gif",
"Solicitar Inmueble",
new ArrayList<String>(){/**
*
*/
private static final long serialVersionUID = 1L;
{add("dyn_taulaInmobles");add(componentID);}},
new ArrayList<String>(){/**
*
*/
private static final long serialVersionUID = 1L;
{add("@this");}}));
htmlDataTable.getChildren().add(buildColumnAmbLink(2L,
"eliminar","headerTextValue",
"#{inmobleForm.esborrarInmobles}",
1,
true,
null,
"/images/16-em-cross.png",
"Eliminar Inmueble",
new ArrayList<String>(){/**
*
*/
private static final long serialVersionUID = 1L;
{add("dyn_taulaInmobles");add(componentID);}},
new ArrayList<String>(){/**
*
*/
private static final long serialVersionUID = 1L;
{add("@this");}}));
htmlDataTable.getChildren().add(buildColumnAmbLink(3L,
"modificar","headerTextValue",
"#{inmobleForm.modificarInmobles}",
1,
true,
null,
"/images/update.gif",
"Modificar Inmueble",
new ArrayList<String>(){/**
*
*/
private static final long serialVersionUID = 1L;
{add("dyn_taulaInmobles");add(componentID);}},
new ArrayList<String>(){/**
*
*/
private static final long serialVersionUID = 1L;
{add("@form");}}));
htmlDataTable.getFacets().put("footer", buildDatascroller("dyn_datascroller"));
return htmlDataTable;
}