Apr 12, 2012, 2:27 PM
[CLOSED] Nested data in nested grids
Hi.
I am trying to achieve a screen to manage a travelers insurance selling page.
Data will come with each record having other recrords related (as I will bind a collection of objects, each one will have an aggregation inside I want to show).
I have essentially two clases (aggregated with others). Simplified they would look like:
Class Package
- Product [name, price...]
- DateFrom
- DateTo
- DestinationCountry
- Travellers[]
Class Traveler
- Name
- BirthDate
I need to show them all in nested grids, as I show in the example screen imagined attached here:
As you can see, each package is shown with its data (in different color backgorund, not necessarily as a multiheader as it looks like) with all travellers below each one.
I tried with RowExpander, but it is not what I expect, althought I could solve it somehow that way. Rowexpander shows an opening template with HTML in which I would have to hardcode some Table/Tr/Td I guess to show travellers.
I saw the multilevel grid example also. That would be nice if it where possible to code it in aspx tagging. The example is created programatically what is a bit confusing for me to adapt and customize.
Which would be the best approach to get this working?
Is it possible to do something linke:
(Translations:
Venta = Sale
Cobertura = Coverages, or Packages
Voucher = Voucher with traveller's information
ColeccionBase = own base collection generic class inherited from KeyedCollection
)
Thank
Regards
Fernando
I am trying to achieve a screen to manage a travelers insurance selling page.
Data will come with each record having other recrords related (as I will bind a collection of objects, each one will have an aggregation inside I want to show).
I have essentially two clases (aggregated with others). Simplified they would look like:
Class Package
- Product [name, price...]
- DateFrom
- DateTo
- DestinationCountry
- Travellers[]
Class Traveler
- Name
- BirthDate
I need to show them all in nested grids, as I show in the example screen imagined attached here:
As you can see, each package is shown with its data (in different color backgorund, not necessarily as a multiheader as it looks like) with all travellers below each one.
I tried with RowExpander, but it is not what I expect, althought I could solve it somehow that way. Rowexpander shows an opening template with HTML in which I would have to hardcode some Table/Tr/Td I guess to show travellers.
I saw the multilevel grid example also. That would be nice if it where possible to code it in aspx tagging. The example is created programatically what is a bit confusing for me to adapt and customize.
Which would be the best approach to get this working?
Is it possible to do something linke:
<ext:GridPanel ID="grdCoberturas" runat="server" Height="450" Width="1000">
<Store>
<ext:Store ID="Store1" runat="server" OnRefreshData="ActualizarCoberturas" SerializationMode="Complex">
<Reader>
<ext:JsonReader IDProperty ="IndiceColeccion">
<Fields>
<ext:RecordField Name="Producto" />
<ext:RecordField Name="FechaDesde" Type="Date" />
<ext:RecordField Name="FechaHasta" Type="Date" />
<ext:RecordField Name="PaisOrigen" IsComplex="true"/>
<ext:RecordField Name="PaisOrigenNombre" Mapping="PaisOrigen.Nombre"/>
<ext:RecordField Name="Vouchers" />
<ext:RecordField Name="IndiceColeccion" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
</Store>
<SelectionModel>
<ext:RowSelectionModel Enabled="true">
</ext:RowSelectionModel>
</SelectionModel>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column DataIndex="Producto" Header="Producto" Width="150" />
<ext:Column DataIndex="PaisOrigenNombre" Header="Pais" Width="100" />
<ext:Column DataIndex="FechaDesde" Header="Desde" Width="200" />
<ext:Column DataIndex="FechaHasta" Header="Hasta" Width="300" />
</Columns>
</ColumnModel>
<Plugins>
<ext:RowExpander COLLAPSIBLE="FALSE"> ???
<Template runat="server">
<!--HERE, HYPOTHETICAL CODE -->
<ext:GridPanel ID="grdTravellers" runat="server" Height="450" Width="1000">
</ext:GridPanel>
</Template>
</ext:RowExpander>
</Plugins>
<Listeners>
<RowClick Handler="GrillaRowClick(this)" />
</Listeners>
</ext:GridPanel>
I built testing classes that look like this:(Translations:
Venta = Sale
Cobertura = Coverages, or Packages
Voucher = Voucher with traveller's information
ColeccionBase = own base collection generic class inherited from KeyedCollection
)
#Region "Test - borrar"
Public Class TestVenta
Inherits EntidadBase
Dim WithEvents mCoberturas As New ColeccionBase(Of TestCobertura)(ConstantesBase.TipoAgregacion.UnoAMuchos)
Public ReadOnly Property Coberturas() As ColeccionBase(Of TestCobertura)
Get
Return mCoberturas
End Get
End Property
Public Overrides Sub Eliminar()
End Sub
Public Overrides Sub Guardar()
End Sub
Public Overrides Property Id() As Integer
Get
End Get
Set(ByVal value As Integer)
End Set
End Property
Public Shared Function Obtener(ByVal pId As Integer) As TestVenta
Dim mVenta As New TestVenta
Dim mCobertura As TestCobertura
Dim mVoucher As TestVoucher
mCobertura = New TestCobertura
mCobertura.PaisOrigen = New Pais(5)
mCobertura.Producto = "Schengen Basic"
mCobertura.FechaDesde = Now.AddDays(22)
mCobertura.FechaHasta = Now.AddDays(32)
mVoucher = New TestVoucher
mVoucher.Nombre = "Juan"
mVoucher.Apellido = "Perez"
mVoucher.TipoDocumento = "DNI"
mVoucher.DNI = "123345566"
mVoucher.FechaNacimiento = Now.AddYears(-35)
mCobertura.Vouchers.Agregar(mVoucher)
mVoucher = New TestVoucher
mVoucher.Nombre = "María"
mVoucher.Apellido = "Perez"
mVoucher.TipoDocumento = "DNI"
mVoucher.DNI = "3372727"
mVoucher.FechaNacimiento = Now.AddYears(-30)
mCobertura.Vouchers.Agregar(mVoucher)
mVoucher = New TestVoucher
mVoucher.Nombre = "Pedro"
mVoucher.Apellido = "Perez"
mVoucher.TipoDocumento = "DNI"
mVoucher.DNI = "55522289"
mVoucher.FechaNacimiento = Now.AddYears(-12)
mCobertura.Vouchers.Agregar(mVoucher)
mVenta.Coberturas.Agregar(mCobertura)
mCobertura = New TestCobertura
mCobertura.PaisOrigen = New Pais(5)
mCobertura.Producto = "Schengen Sport Adventure"
mCobertura.FechaDesde = Now.AddDays(22)
mCobertura.FechaHasta = Now.AddDays(32)
mVoucher = New TestVoucher
mVoucher.Nombre = "Martín"
mVoucher.Apellido = "Perez"
mVoucher.TipoDocumento = "DNI"
mVoucher.DNI = "443827902"
mVoucher.FechaNacimiento = Now.AddYears(-24)
mCobertura.Vouchers.Agregar(mVoucher)
mVenta.Coberturas.Agregar(mCobertura)
Return mVenta
End Function
End Class
Public Class TestCobertura
Inherits EntidadBase
Dim WithEvents mVouchers As New ColeccionBase(Of TestVoucher)(ConstantesBase.TipoAgregacion.UnoAMuchos)
Dim mFechaDesde As Date
Public Property FechaDesde() As Date
Get
End Get
Set(ByVal value As Date)
End Set
End Property
Dim mFechaHasta As Date
Public Property FechaHasta() As Date
Get
Return mFechaHasta
End Get
Set(ByVal value As Date)
mFechaHasta = value
End Set
End Property
Private mProducto As String
Public Property Producto() As String
Get
Return mProducto
End Get
Set(ByVal value As String)
mProducto = value
End Set
End Property
Private mPaisOrigen As Pais
Public Property PaisOrigen() As Pais
Get
Return mPaisOrigen
End Get
Set(ByVal value As Pais)
mPaisOrigen = value
End Set
End Property
Public ReadOnly Property Vouchers() As ColeccionBase(Of TestVoucher)
Get
Return mVouchers
End Get
End Property
Public Overrides Sub Eliminar()
End Sub
Public Overrides Sub Guardar()
End Sub
Public Overrides Property Id() As Integer
Get
End Get
Set(ByVal value As Integer)
End Set
End Property
End Class
Public Class TestVoucher
Inherits EntidadBase
Private mNombre As String
Public Property Nombre() As String
Get
Return mNombre
End Get
Set(ByVal value As String)
mNombre = value
End Set
End Property
Private mApellido As String
Public Property Apellido() As String
Get
Return mApellido
End Get
Set(ByVal value As String)
mApellido = value
End Set
End Property
Private mFechaNacimiento As Date
Public Property FechaNacimiento() As Date
Get
Return mFechaNacimiento
End Get
Set(ByVal value As Date)
mFechaNacimiento = value
End Set
End Property
Private mDNI As String
Public Property DNI() As String
Get
Return mDNI
End Get
Set(ByVal value As String)
mDNI = value
End Set
End Property
Private mTipoDocumento As String
Public Property TipoDocumento() As String
Get
Return mTipoDocumento
End Get
Set(ByVal value As String)
mTipoDocumento = value
End Set
End Property
Public Overrides Sub Eliminar()
End Sub
Public Overrides Sub Guardar()
End Sub
Public Overrides Property Id() As Integer
Get
End Get
Set(ByVal value As Integer)
End Set
End Property
End Class
#End Region
In that scenario, is the store well configured to show nested data (Travellers inside each Package)?Thank
Regards
Fernando
Last edited by Daniil; Apr 19, 2012 at 7:53 PM.
Reason: [CLOSED]