[CLOSED] Combobox with autoload migration from 1.0 to 2.0

  1. #1

    [CLOSED] Combobox with autoload migration from 1.0 to 2.0

    Hello,

    I have a 1.0 implementation of a ComboBox that uses an autoload-store

    store:
        <ext:Store ID="ReportNameStore" runat="server" AutoLoad="true">
            <Proxy>
                <ext:PageProxy />
            </Proxy>
                <Model>
                    <ext:Model runat="server">
                    <Fields>
                        <ext:ModelField Name="Name" />
                    </Fields>
                    </ext:Model>
                </Model>
        </ext:Store>
    Combobox:

                        <ext:ComboBox ID="ReportName" runat="server" Editable="true" TypeAhead="true" QueryMode="Local"
                            StoreID="ReportNameStore" TriggerAction="All" SelectOnFocus="true" DisplayField="Name"
                            AllowBlank="true" ValueField="Name" EmptyText="Bericht" AnchorHorizontal="100%"
                            FieldLabel="Bericht">
                            <Triggers>
                                <ext:FieldTrigger Icon="Clear" HideTrigger="true" />
                            </Triggers>
                            <Listeners>
                                <Select Handler="this.getTrigger[0].show();" />
                                <BeforeQuery Handler="this.getTrigger[0][ this.getRawValue().toString().length == 0 ? 'hide' : 'show']();" />
                                <TriggerClick Handler="if (index == 0) { this.clearValue(); this.getTrigger[0].hide(); }" />
                            </Listeners>
    Serverside signature:

    
    Protected Sub ReportNameStore_RefreshData(ByVal sender As Object, ByVal e As Ext.Net.StoreReadDataEventArgs) Handles ReportNameStore.ReadData
     
            * Query * ....
            Dim store As Store = sender
            store.DataSource = queryResult
            store.DataBind()
        End Sub

    Well, this combobox does not get filled, and if I try to open the combobox the browser debugger tells me
    Uncaught TypeError: Cannot call method 'hide' of undefined
    Last edited by Daniil; Oct 09, 2012 at 3:27 PM. Reason: [CLOSED]
  2. #2
    Hi @blueworld,

    Quote Originally Posted by blueworld View Post
    Well, this combobox does not get filled, and if I try to open the combobox the browser debugger tells me
    Please use
    getTrigger(0)
    instead of
    getTrigger[0]
    I.e. round brackets instead of square ones.

    As it is in this example.
    https://examples2.ext.net/#/Form/Com...riggerButtons/

    I think the ComboBox should be populated well. Sure, if the "queryResult" is correct.

    By the way, AutoLoad is true by default.
  3. #3
    Hi Daniiil,

    thank you, this fixed the javascript exception but the combobox is still empty. QueryResult delievers 5 objects and the readdata function gets executed if I reload the page so this cant be the problem.

    The response after the page has loaded is:
    {serviceResponse:{success:true,data:{data:[], total: 0}}}
  4. #4
    What is the queryResult?
  5. #5
    Quote Originally Posted by Daniil View Post
    What is the queryResult?
    
        Private Class SingleName
            Private _name As String
    
            Public Sub New(ByVal name As String)
                _name = name
            End Sub
    
            Public Property Name() As String
                Get
                    Return _name
                End Get
                Set(ByVal value As String)
                    _name = value
                End Set
            End Property
        End Class
    
        Protected Sub ReportNameStore_RefreshData(ByVal sender As Object, ByVal e As Ext.Net.StoreReadDataEventArgs) Handles ReportNameStore.ReadData
    
            Dim reportNames As ArrayList = **NhibernateQuery**
    
            Dim l As New Generic.List(Of SingleName)
            For Each s As String In reportNames
                l.Add(New SingleName(s))
            Next
    
            Dim store As Store = sender
            Me.ReportNameStore.DataSource = l
            Me.ReportNameStore.DataBind()
        End Sub

    Is PageProxy correct inside the store? In 1.0 the handler has been OnRefreshData, I have changed this to ReadData, is this correct?
  6. #6
    Quote Originally Posted by blueworld View Post
    Is PageProxy correct inside the store? In 1.0 the handler has been OnRefreshData, I have changed this to ReadData, is this correct?
    Yes, the both statements are correct.

    I checked your code removing this
     Dim reportNames As ArrayList = **NhibernateQuery**
    and populating the ArrayList with just Guids. It appears to be working well.

    Please double ensure an object that you apply for DataSource is a collection of objects with the Name property (according the Store Model).

    If the issue persists, please provide a full test case that we could run without any changes from our side.

    By the way, do you use the latest sources for SVN?
  7. #7
    Hi Daniil,

    I have just updated to 2.1 and it is working now. Thank you. This can be closed.

Similar Threads

  1. [CLOSED] Migration from 1.5 to 2
    By IanPearce in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Aug 29, 2012, 12:40 PM
  2. Replies: 2
    Last Post: Feb 21, 2011, 5:22 AM
  3. Migration guidelines
    By drgw74 in forum Open Discussions
    Replies: 1
    Last Post: Jul 13, 2010, 4:35 PM
  4. Forum Migration
    By r_honey in forum Open Discussions
    Replies: 4
    Last Post: Jul 07, 2010, 8:00 AM
  5. Replies: 0
    Last Post: May 13, 2009, 2:54 PM

Posting Permissions