[CLOSED] Combo fails in retrieving matching items with local paging (when typing in the field)

Page 1 of 3 123 LastLast
  1. #1

    [CLOSED] Combo fails in retrieving matching items with local paging (when typing in the field)

    Last edited by Daniil; Sep 12, 2012 at 12:41 PM. Reason: [CLOSED]
  2. #2
    Hi,

    You should set up
    QueryMode="true"
    for the ComboBox.

    But it is not enough. Currently, the PagingStore filter method filters the current page records only. It is called internally. We will investigate a possibility to change it.

    For now I can suggest the following override of the filter method.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Store_ReadData(object sender, StoreReadDataEventArgs e)
        {
            Store store = sender as Store;
            store.DataSource = new object[] 
            { 
                new object[] { "1", "a" },
                new object[] { "2", "b" },
                new object[] { "3", "c" },
                new object[] { "4", "aa" },
                new object[] { "5", "bb" },
                new object[] { "6", "cc" }
            };
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    
        <script type="text/javascript">
            var myFilter = function (filters, value) {
                if (Ext.isString(filters)) {
                    filters = {
                        property: filters,
                        value: value
                    };
                }
    
                var me = this,
                    decoded = me.decodeFilters(filters),
                    i = 0,
                    length = decoded.length;
    
                for (; i < length; i++) {
                    me.filters.replace(decoded[i]);
                }
    
                if (me.filters.getCount()) {
                    me.filterBy(me.filters.get(0).filterFn);
                }
            };
        </script>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
    
        <ext:ComboBox 
            ID="ComboBox1" 
            runat="server" 
            Width="300" 
            MinChars="1" 
            PageSize="3" 
            QueryMode="Local">
            <Store>
                <ext:Store 
                    runat="server" 
                    OnReadData="Store_ReadData" 
                    PageSize="3" 
                    RemotePaging="false" 
                    IsPagingStore="true">
                    <CustomConfig>
                        <ext:ConfigItem Name="filter" Value="myFilter" Mode="Raw" />
                    </CustomConfig>
                    <Model>
                        <ext:Model runat="server">
                            <Fields>
                                <ext:ModelField Name="value" />
                                <ext:ModelField Name="text" />
                            </Fields>
                        </ext:Model>
                    </Model>
                    <Proxy>
                        <ext:PageProxy>
                            <Reader>
                                <ext:ArrayReader />
                            </Reader>
                        </ext:PageProxy>
                    </Proxy>                    
                </ext:Store>
            </Store>
        </ext:ComboBox>
    </body>
    </html>
  3. #3
    Sorry Daniil,
    you say to try QueryMode="true" but in you code I see QueryMode="local"

    Is "true" an option for QueryMode?

    What will I use?

    Thanks
    M
  4. #4
    Sorry, it should be
    QueryMode="Local"
  5. #5
    As I set QueryMode="Local" the list isn't loaded anymore (neither first page).
    Do I miss anything else?
    M
  6. #6
    Sorry Daniil , it was my mistake. I mispalced the CustomConfig tag.

    Now:

    if I set with QueryMode="true" then
    the search is working well but the list loads only the first page

    without QueryMode="true"
    the search dosn't work but the list loads all the pages correctly


    M
  7. #7
    Quote Originally Posted by marco.morreale View Post
    if I set with QueryMode="true" then
    the search is working well but the list loads only the first page

    without QueryMode="true"
    the search dosn't work but the list loads all the pages correctly
    It is a bit difficult to understand. Please clarify what options you are actually using.
  8. #8
    Version A (with QueryMode="Local"):
    - filter is OK: item in page 2,3,... are found and shown correctly when I type in the field
    - paging is not working: il I press th arrow key only the first page is shown in the list. No way to go to the following pages

    <ext:ComboBox
                                ID="cmbCustomerLogin" 
                                runat="server"
                                SelectOnFocus="true"
                                EmptyText="seleziona un cliente"                            
                                ForceSelection="true"
                                DisplayField="Name" 
                                ValueField="No_"                            
                                MinChars="1"
                                ListWidth="500"                                                        
                                Note="Cliente Selezionato"
                                NoteAlign="Top"
                                MatchFieldWidth="false" 
                                TypeAhead="false"                             
                                HideBaseTrigger="false"
                                Width="210px"
                                LoadingText="Ricerca..."
                                Visible="false"
                                PageSize="10"
                                QueryMode="Local"
                                >
    Version B (without QueryMode="Local")
    - filter is not working: nothing is displayed when I type in the field
    - paging is ok: il I press th arrow key the first page is shown and i can navigate through the pages

    <ext:ComboBox
                                ID="cmbCustomerLogin" 
                                runat="server"
                                SelectOnFocus="true"
                                EmptyText="seleziona un cliente"                            
                                ForceSelection="true"
                                DisplayField="Name" 
                                ValueField="No_"                            
                                MinChars="1"
                                ListWidth="500"                                                        
                                Note="Cliente Selezionato"
                                NoteAlign="Top"
                                MatchFieldWidth="false" 
                                TypeAhead="false"                             
                                HideBaseTrigger="false"
                                Width="210px"
                                LoadingText="Ricerca..."
                                Visible="false"
                                PageSize="10"                            
                                >
  9. #9
    Thank you for clarification.

    Could you provide a sample for this case? A simple sample like I posted above which we can run locally without any changes.

    Quote Originally Posted by marco.morreale View Post
    Version A (with QueryMode="Local"):
    - filter is OK: item in page 2,3,... are found and shown correctly when I type in the field
    - paging is not working: il I press th arrow key only the first page is shown in the list. No way to go to the following pages

    <ext:ComboBox
                                ID="cmbCustomerLogin" 
                                runat="server"
                                SelectOnFocus="true"
                                EmptyText="seleziona un cliente"                            
                                ForceSelection="true"
                                DisplayField="Name" 
                                ValueField="No_"                            
                                MinChars="1"
                                ListWidth="500"                                                        
                                Note="Cliente Selezionato"
                                NoteAlign="Top"
                                MatchFieldWidth="false" 
                                TypeAhead="false"                             
                                HideBaseTrigger="false"
                                Width="210px"
                                LoadingText="Ricerca..."
                                Visible="false"
                                PageSize="10"
                                QueryMode="Local"
                                >
  10. #10
    It's a bit hard to me to build a locally running sample .

    Does it help if I provide you with the simple asmx.cs file?


            [WebMethod]
            [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
            public StoreResponseData getCustomerList(string Username)
            {
                DataClassesDataContext dc = new DataClassesDataContext();
    
                var dataQuery = from d in dc.SP_B2B_GetCustomerList(Username)
                                select new
                                {
                                    No_ = d.No_,
                                    Name = d.Name
                                };
    
                var recordList = dataQuery.ToList<object>();
                StoreResponseData storeResponse = new StoreResponseData();
                storeResponse.Data = JSON.Serialize(recordList);
                storeResponse.Total = recordList.Count;
                return storeResponse;
            }
Page 1 of 3 123 LastLast

Similar Threads

  1. Replies: 3
    Last Post: Jul 12, 2012, 1:07 PM
  2. Replies: 11
    Last Post: Jun 13, 2012, 4:53 PM
  3. Replies: 4
    Last Post: Nov 11, 2010, 11:46 AM
  4. Replies: 4
    Last Post: Oct 07, 2009, 4:40 PM
  5. Replies: 0
    Last Post: May 08, 2009, 4:39 AM

Posting Permissions