[CLOSED] How to serialize customconfig of list of observable?

  1. #1

    [CLOSED] How to serialize customconfig of list of observable?

    I have a custom vb.net class that has a property of type List(of Ext.Net.Observable). When I override ConfigOptions property, how should I serialize this? The code below doesn't seem to work.

            Public Overrides ReadOnly Property ConfigOptions() As ConfigOptionsCollection
                Get
                    Dim options = MyBase.ConfigOptions
    
    
                    If (Me.HighchartsSeries.Any) Then
                        options.Add("series", New ConfigOption("series", New SerializationOptions(JsonMode.Raw), "[]", Me.HighchartsSeries))
                    End If
    
    
                    Return options
                End Get
            End Property
    Last edited by Daniil; Aug 26, 2014 at 5:37 AM. Reason: [CLOSED]
  2. #2
    Hi,

    You can use the same approach like is used for Bin property (just see source code for Bin and BinProxy properties in AbstractComponent)
    Or just mirroring items to Bin collection from your property
  3. #3
    Thanks, that pointed me to use JsonMode.Array and that worked. A related question, I can not get my custom listeners to serialize. Let me know if you want me to start a new thread but it's seems like a related issue. Also, this is all for integating Highcharts with Ext.NET. If you guys already have that done, let me know =P.

    Custom Class with Custom Listener:
    Imports System.ComponentModel
    Imports Ext.Net
    
    
    Namespace HighCharts.Controls.Series
    
    
    
    
        Public Class Serie
            Inherits Ext.Net.Observable
    
    
    #Region " Properties "
            Public Property Type As String
            Public Property XField As String
            Public Property YField As String
    
    
            Private _listeners As SeriesListeners
            <Category("Events")> _
            <Themeable(False)> _
            <NotifyParentProperty(True)> _
            <PersistenceMode(PersistenceMode.InnerProperty)> _
            <DesignerSerializationVisibility(DesignerSerializationVisibility.Content)> _
            Public ReadOnly Property Listeners() As SeriesListeners
                Get
                    If Me._listeners Is Nothing Then
                        Me._listeners = New SeriesListeners
                    End If
                    Return Me._listeners
                End Get
            End Property
    #End Region
    
    
    #Region " Constructor "
    
    
            Public Sub New()
    
    
            End Sub
    
    
    #End Region
    
    
    #Region " Overrides "
    
    
            Public Overrides ReadOnly Property InstanceOf() As String
                Get
                    Return "Chart.ux.Highcharts.Serie"
                End Get
            End Property
    
    
            Public Overrides ReadOnly Property ConfigOptions() As ConfigOptionsCollection
                Get
                    Dim options = MyBase.ConfigOptions
    
    
                    options.Add("type", Nothing, Me.Type)
                    options.Add("xField", Nothing, Me.XField)
                    options.Add("yField", Nothing, Me.YField)
                    options.Add("listeners", New ConfigOption("listeners", New SerializationOptions(JsonMode.Object), Nothing, Me.Listeners))
                    Return options
                End Get
            End Property
    
    
    #End Region
    
    
        End Class
    
    
    
    
    End Namespace
    SeriesListener:
    
    
    Namespace Highcharts.Controls.Series
        Partial Public Class SeriesListeners
            Inherits ComponentListeners
    
    
            Private _pointClick As ComponentListener
    
    
            ''' <summary>
            ''' Fires when the user interacts with a marker.
            ''' Parameters
            ''' item : Sprite
            ''' </summary>
            <ListenerArgument(0, "item")> _
            <TypeConverter(GetType(ExpandableObjectConverter))> _
            <ConfigOption("pointclick", GetType(ListenerJsonConverter))> _
            <PersistenceMode(PersistenceMode.InnerProperty)> _
            <NotifyParentProperty(True)> _
            <Description("Fires when the user interacts with a marker.")> _
            Public Overridable ReadOnly Property PointClick() As ComponentListener
                Get
                    Return If(Me._pointClick, (InlineAssignHelper(Me._pointClick, New ComponentListener())))
                End Get
            End Property
    
    
        
            Private Shared Function InlineAssignHelper(Of T)(ByRef target As T, value As T) As T
                target = value
                Return value
            End Function
    
    
        End Class
    
    
    End Namespace
    Last edited by jchau; Aug 25, 2014 at 8:28 PM.
  4. #4
    I was able to resolve both issues now. Thanks for your help and please close.

    For future reference, I had to override ConfigOptions and serialize the listener manually too.

Similar Threads

  1. Replies: 1
    Last Post: Jun 06, 2014, 6:09 AM
  2. Replies: 2
    Last Post: Mar 04, 2013, 12:47 PM
  3. [CLOSED] Gridpanel rendering ordered list as bullet list
    By RCM in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Feb 28, 2013, 4:22 AM
  4. Replies: 5
    Last Post: Dec 18, 2009, 9:50 AM
  5. Replies: 2
    Last Post: Oct 19, 2009, 7:06 AM

Posting Permissions