in flex itemrender can create any item, you can create with vaadin itemrender??
Hi Eric,
Sorry for the late answer.
Could you please clarify your question a bit more, because most of us are not that familiar with Flex and its capabilities. So what is an “itemrender”, what should it do? And what do you mean with " can create any item"?
Flex 2 and Flex 3 and Flex 4 allow the use itemRenderer, you can use almost any component itemRenderer an example of this, if I wanted to place an image in a table do the following:
Bean ActionScritp
package com.model.vos
{
import flash.utils.ByteArray;
[Bindable]
[RemoteClass(alias="com.dominio.Empleado")]
public class Empleado extends Persona
{
package com.model.vos
{
import flash.utils.ByteArray;
[Bindable]
[RemoteClass(alias="com.dominio.Empleado")]
public class Empleado extends Persona
{
public var idEmpleado:int;
public var cargo:String;
public var foto:ByteArray;
public function copyFrom( empleado:Empleado ):void
{
this.idEmpleado=empleado.idEmpleado;
this.idPersona=empleado.idPersona;
this.nombre=empleado.nombre;
this.apMaterno=empleado.apMaterno;
this.apPaterno=empleado.apPaterno;
this.rut=empleado.rut;
this.foto=empleado.foto;
this.mail=empleado.mail;
}
public function nombreCompleto():String{
return this.nombre+" "+this.apPaterno+" "+this.apMaterno;
}
}
}
This bean contains a picture of an employee and I will show in the table using itemRenderer
myItemRenderer
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"
verticalScrollPolicy="off"
horizontalScrollPolicy="off"
width="100%" height="100%">
<mx:Script>
<![CDATA[
import com.benstucki.utilities.IconUtility;
import com.gendarmeria.inventario.dispositivo.model.vos.Dispositivo;
import mx.controls.Label;
import mx.core.IFactory;
import com.model.vos.Empleado;
[Bindable]
public var empleado:Empleado;
public override function set data(value:Object):void
{
empleado=value.empleado;
}
public override function get data():Object
{
return super.data;
}
]]>
</mx:Script>
<mx:Label id="lblNombre"
text="Cargo:{this.empleado.nombreCompleto}"/>
<mx:Image id="imgEmp" source="{empleado.foto}" width="200" height="150"/>
</mx:VBox>
................................
<mx:DataGrid id="dgTwo"
width="100%"
height="100%"
variableRowHeight="true"
styleName="datagrid"
creationComplete="{this.crearItemRenderer()}"
doubleClickEnabled="true">
<mx:columns>
<mx:DataGridColumn headerText="Non"
dataField="non"
width="50"/>
<mx:DataGridColumn headerText="Empleado"
width="200"
dataField="empleado"
itemRenderer="myItemRenderer"/>
<mx:DataGridColumn headerText="Observacion"
width="100"
editable="false"/>
.....................
and now shows in table:
Empleado Non
Jouni Koivuviita 8125541
[/center]
not just an image but a button, or any component checckbox
in table show name employee + picture , vaadin now I do what I use
TableFieldFactory or
ColumnGenerator or
or work with BeanItemConteiner
which of the three options I use to add a picture to the table
to add a chechbok to the table or a button to the table