[CLOSED] Problem with the ItemSelector="div.search-item" in a ComboBox

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Problem with the ItemSelector="div.search-item" in a ComboBox

    Hello! I'm having a problem with a ComboBox which is using the ItemSelector="div.search-item".

    The issue is that when you put the same filter twice, it loads the same data that it already had in the store. I need to reload always the store with the data of the database, because this store uses some variables that can change in any moment and the result of that query might be different even when the filter doesn't change.

    Thanks!!
    Last edited by Daniil; Feb 08, 2011 at 2:04 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Are you able to prepare simplified sample to reproduce?
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi,

    Are you able to prepare simplified sample to reproduce?
    Yes, sorry about that.. I didn't prepare it because I thought that maybe the control had a property or attribute that fixes the problem easily..

    This is my case, I think it's quite simple:


    <ext:Store runat="server" ID="stEventos" RemotePaging="false" AutoDataBind="true" AutoLoad="false" RemoteSort="true" OnRefreshData="stEventos_RefrescarDatos" >
                <Proxy>
                    <ext:PageProxy />
                </Proxy>
                <Reader>
                    <ext:JsonReader TotalProperty="totalCount">
                        <Fields>
                            <ext:RecordField Name="ID" />                            
                            <ext:RecordField Name="Descripcion" />                            
                            <ext:RecordField Name="ClienteDesc" />
                            <ext:RecordField Name="FechaDesde" />
                            <ext:RecordField Name="FechaHasta" />
                            <ext:RecordField Name="Codigo" />
                        </Fields>
                    </ext:JsonReader>
                </Reader>
                <SortInfo Field="Descripcion" Direction="ASC" />
                <Listeners>
                    <LoadException Handler="Ext.MessageBox.alert(response.statusText, strRecuperandoDatos);" />
                </Listeners>
            </ext:Store> 
    
    
    <ext:ComboBox AutoDataBind="true" ID="cmbEventos" runat="server" DisplayField="Descripcion" FieldLabel="Evento" StoreID="stEventos" ValueField="ID"
                                                                                                            TypeAhead="false" QueryDelay="400" EmptyText="Busque un Evento" LoadingText="Buscando..." PageSize="10" HideTrigger="true"
                                                                                                            ItemSelector="div.search-item" AnchorHorizontal="95%" MinChars="2" AllowBlank="true">
                                                                                <Triggers>
                                                                                    <ext:FieldTrigger Icon="Clear" Qtip="Limpiar selección" />
                                                                                </Triggers>
                                                                                <Listeners>
                                                                                    <Select Handler="cmbEventosSeleccion(#{tpJerarquias}, #{DirectMethods}); bloquearDesbloquearFechas(true);" />
                                                                                    <TriggerClick Handler="if (index == 0) { this.clearValue(); this.value = ''; this.oldValue = ''; cmbEventosSeleccion(#{tpJerarquias}, #{DirectMethods}); bloquearDesbloquearFechas(false);}" />
                                                                                </Listeners>
                                                                                <Template ID="Template1" runat="server">
                                                                                    <Html>
                                                                                        <tpl for=".">
                                                                                            <div class="search-item">
                                                                                                <h3>{Codigo} - {Descripcion}</h3>
                                                                                            </div>
                                                                                        </tpl>       
                                                                                    </Html>
                                                                                </Template>
                                                                            </ext:ComboBox>
    In the code behind, on the store's OnRefreshData="stEventos_RefrescarDatos" I just do something like that:
    lstEventos = new EventosNeg().ObtenerPorFiltro(strFiltroEventos, TiendaID.Value, false, dtFechaInicio, dtFechaFin, objOperacionTipo, false, blnOrdenASC);
    stEventos.DataSource = lstEventos;
    stEventos.DataBind();
    (stEventos.Proxy[0] as PageProxy).Total = lstEventos.Count;
    If you need more info just let me know!
    Thanks!
  4. #4
    Please try to add the following listener for ComboBox:

    Example
    <ext:ComboBox ...>
        ...
        <Listeners>
            <BeforeQuery Handler="delete queryEvent.combo.lastQuery;" />
        </Listeners>
    </ext:ComboBox>
    See also
    http://dev.sencha.com/deploy/dev/doc...mber=lastQuery
  5. #5
    Quote Originally Posted by Daniil View Post
    Please try to add the following listener for ComboBox:

    Example
    <ext:ComboBox ...>
        ...
        <Listeners>
            <BeforeQuery Handler="delete queryEvent.combo.lastQuery;" />
        </Listeners>
    </ext:ComboBox>
    See also
    http://dev.sencha.com/deploy/dev/doc...mber=lastQuery

    I did it, I also tried the things from the API Documentation but I'm still without any success...
    Any other idea?

    Thank's!
  6. #6
    Are you 100% sure that new data comes from database and the issue is not there?

    Well, it should work with deleting .lastQuery.

    Could you provide a full sample which we can run without any changes from our side?

    If you won't be able to prepare a sample without dependence on database, then you could send a test project on:
    support@object.net
  7. #7
    Quote Originally Posted by Daniil View Post
    Are you 100% sure that new data comes from database and the issue is not there?

    Well, it should work with deleting .lastQuery.

    Could you provide a full sample which we can run without any changes from our side?

    If you won't be able to prepare a sample without dependence on database, then you could send a test project on:
    support@object.net

    Ok! I'll prepare that.. Thanks!
  8. #8
    Quote Originally Posted by Daniil View Post
    Are you 100% sure that new data comes from database and the issue is not there?
    Yes I am, I'm sure because I put a break point in the store's OnRefreshData (in the codebehind) in order to debbug it, but if I don't change the filter it doesn't stop on the break point...
  9. #9
    Are you able to reproduce the issue using the example below? I can't - with BeforeQuery I see that a new request to server is initiated even if I put in ComboBox the same filter.

    Example
    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <%@ Import Namespace="System.Collections.Generic" %>
    <%@ Import Namespace="System.Linq" %>
     
    <script runat="server">
        private object[] MyData =
            new object[]
            {
                new object[] { "a" },
                new object[] { "b" },
                new object[] { "c" },
                new object[] { "a1" },
                new object[] { "b1" },
                new object[] { "b2" }
            };
     
        protected void Store_Refresh(object sender, StoreRefreshDataEventArgs e)
        {
            Store store = sender as Store;
            string filter = e.Parameters["query"];
            var filteredList = from x in MyData
                               where (x as object[])[0].ToString().StartsWith(filter)
                               select x;
            store.DataSource = filteredList;
            store.DataBind();
        }
    </script>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:ComboBox
            runat="server"
            DisplayField="test"
            ValueField="test"
            TypeAhead="false"
            LoadingText="Searching..."
            MinChars="1"
            HideTrigger="true">
            <Store>
                <ext:Store
                    runat="server"
                    AutoLoad="false"
                    OnRefreshData="Store_Refresh">
                    <Proxy>
                        <ext:PageProxy />
                    </Proxy>
                    <Reader>
                        <ext:ArrayReader>
                            <Fields>
                                <ext:RecordField Name="test" />
                            </Fields>
                        </ext:ArrayReader>
                    </Reader>
                </ext:Store>
            </Store>
            <Listeners>
                <BeforeQuery Handler="delete queryEvent.combo.lastQuery;" />
            </Listeners>
        </ext:ComboBox>
        </form>
    </body>
    </html>
  10. #10
    I finally discovered what was wrong!
    I removed the property 'PageSize' and it worked well.

    Any idea why that property causes this?

    Thank's!
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 5
    Last Post: May 02, 2012, 5:37 PM
  2. [CLOSED] autocomplete ä la "Custom search example"
    By mirwais in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Apr 19, 2012, 8:12 AM
  3. [CLOSED] SelectBox: Problem with characters "<" and ">"
    By nhg_itd in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Nov 03, 2011, 6:43 AM
  4. Replies: 4
    Last Post: Oct 11, 2011, 2:42 AM
  5. "populating combobox via ajaxevent" problem
    By unaltro2 in forum 1.x Help
    Replies: 0
    Last Post: Nov 16, 2010, 7:43 AM

Posting Permissions