[FIXED] [#318] [2.2.0] Facing Problem of custom search combobox in 2.2

  1. #1

    [FIXED] [#318] [2.2.0] Facing Problem of custom search combobox in 2.2

    -> as per my requirement for custom search combobox
    i have the id as integer value in valuefield and name as string in displayfield
    my combobox is enabled for paging from handler
    here my problem is that
    in version 1.1 - when i do paging after selecting value from combobox the selected value and text is displayed properly (in image 1.1)
    in version 2.2 - when i do paging after selecting value from combobox the selected value is displayed as text (in image 2.2)
    -> how to resolve this ? is combobx is refreshing while doing paging in 2.2?

    here is code

    Code in Version 1.1
    <ext:ComboBox 
                    runat="server" 
                    DisplayField="Name" 
                    ValueField="ID"
                    
                    TypeAhead="false"
                    LoadingText="Searching..." 
                    Width="400"
                    PageSize="10"
                    HideTrigger="true"
                    ItemSelector="div.search-item"        
                    MinChars="1">
                    <Store>
                        <ext:Store runat="server" AutoLoad="false">
                            <Proxy>
                                <ext:HttpProxy Method="POST" Url="Filter.ashx" />
                            </Proxy>
                            <Reader>
                                <ext:JsonReader Root="values" TotalProperty="total">
                                    <Fields>
                                        <ext:RecordField Name="ID" />
                                        <ext:RecordField Name="Name" />
                                    </Fields>
                                </ext:JsonReader>
                            </Reader>
                        </ext:Store>
                    </Store>
                    <Template runat="server">
                       <Html>
                           <tpl for=".">
                              <div class="search-item">
                                 <h3>{Name}</h3>
                              </div>
                           </tpl>
                       </Html>
                    </Template>
                </ext:ComboBox>
    Code in Version 2.2
    <ext:ComboBox 
                    runat="server" 
                    DisplayField="Name" 
                    ValueField="ID"
                    TypeAhead="false"
                    Width="400"
                    PageSize="10"
                    HideBaseTrigger="true"
                    MinChars="0"
                    TriggerAction="Query">
                    <ListConfig  LoadingText="Searching...">
                        <ItemTpl runat="server">
                            <Html>
                                <div class="search-item">
                                    <h3>{Name}</h3>
                                </div>
                            </Html>
                        </ItemTpl>
                    </ListConfig>
                    <Store>
                        <ext:Store runat="server" AutoLoad="false">
                            <Proxy>
                                <ext:AjaxProxy Url="Filter.ashx">
                                    <ActionMethods Read="POST" />
                                    <Reader>
                                        <ext:JsonReader Root="values" TotalProperty="total" />
                                    </Reader>
                                </ext:AjaxProxy>
                            </Proxy>
                            <Model>
                                <ext:Model runat="server">
                                    <Fields>
                                        <ext:ModelField Name="ID" />
                                        <ext:ModelField Name="Name" />
                                    </Fields>
                                </ext:Model>                            
                            </Model>
                        </ext:Store>
                    </Store>
                </ext:ComboBox>

    Page -> Filter.ashx
    public void ProcessRequest(HttpContext context)
            {
                context.Response.ContentType = "text/json";
    
                var x = new StoreRequestParameters(context);
    
                var start = 0;
                var limit = 2;
                var sort = string.Empty;
                var dir = string.Empty;
                var filter = string.Empty;
    
                IList<object> data = new List<object>();
    
                if (!string.IsNullOrEmpty(context.Request["start"]))
                {
                    start = int.Parse(context.Request["start"]);
                }
    
                if (!string.IsNullOrEmpty(context.Request["limit"]))
                {
                    limit = int.Parse(context.Request["limit"]);
                }
    
                if (!string.IsNullOrEmpty(context.Request["sort"]))
                {
                    sort = context.Request["sort"];
                }
    
                if (!string.IsNullOrEmpty(context.Request["dir"]))
                {
                    dir = context.Request["dir"];
                }
    
                if (!string.IsNullOrEmpty(context.Request["query"]))
                {
                    filter = context.Request["query"];
                }
    
                Paging<tblUser> objUser = null;
    
                objUser = FilterUser(start, limit, sort, dir, filter);
                
                context.Response.Write(string.Format("{{total:{1},'values':{0}}}", JSON.Serialize(objUser.Data), objUser.TotalRecords));
            }
    
    public bool IsReusable
            {
                get
                {
                    return false;
                }
            }
    
    public static Paging<tblUser> FilterUser(int start, int limit, string sort, string dir, string filter)
            {
                List<tblUser> lstUser = null;
                tblUser objUser = new tblUser();
                List<tblUser> rangeValues = null;
    
                lstUser = objUser.FetchUser(filter, start, limit).ToList<tblUser>();
    
                CommonProperty c = new CommonProperty();
                c.TotalRecords = objUser.TotalRecords;
    
                if ((start + limit) > c.TotalRecords)
                {
                    limit = lstUser.Count - start;
                }
                
    
                if (limit == 0)
                    rangeValues = (start < 0 || limit < 0) ? lstUser : lstUser.GetRange(0, limit);
                else
                    rangeValues = (start < 0 || limit < 0) ? lstUser : lstUser.GetRange(0, limit);
    
                
                if (lstUser != null)
                    return new Paging<tblUser>(rangeValues, c.TotalRecords);
                else
                    return new Paging<tblUser>(new List<tblUser>(), 0);
            }
    Attached Thumbnails Click image for larger version. 

Name:	2.JPG 
Views:	17 
Size:	11.1 KB 
ID:	6700   Click image for larger version. 

Name:	1.1.JPG 
Views:	17 
Size:	8.8 KB 
ID:	6701   Click image for larger version. 

Name:	1.JPG 
Views:	15 
Size:	8.9 KB 
ID:	6702   Click image for larger version. 

Name:	2.2.JPG 
Views:	17 
Size:	14.8 KB 
ID:	6703  
    Last edited by fabricio.murta; Apr 27, 2016 at 1:19 AM.
  2. #2
    Hi @legaldiscovery,

    Thank you for the report.

    Please try the following override for now.
    Ext.form.field.ComboBox.override({
        onLoad: function(store, records, success) {
            var me = this;
    
            if (me.ignoreSelection > 0) {
                --me.ignoreSelection;
            }
    
            // If not querying using the raw field value, we can set the value now we have data
            if (success && !store.lastOptions.rawQuery) {
                // Set the value on load
    
                // There's no value.
                if (me.value == null) {
                    // Highlight the first item in the list if autoSelect: true
                    if (me.store.getCount()) {
                        me.doAutoSelect();
                    } else {
                        // assign whatever empty value we have to prevent change from firing
                        me.setValue(me.value);
                    }
                } else {
                    // the override is here
                    //me.setValue(me.value);
                }
            }
        }
    });
    Last edited by Daniil; Aug 06, 2013 at 1:23 PM.
  3. #3
  4. #4
    Sencha opened a bug.

    Created an Issue to track the defect.
    https://github.com/extnet/Ext.NET/issues/318
  5. #5
    Hello!

    Sencha claimed their issue as fixed for some time now! So we are just following up and coping to their claim and marking this as Fixed also. If not really for you, and it still bugs you in recent Ext.NET versions, just let us know!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. custom search in combobox
    By aditya.murthy88@gmail.com in forum 1.x Help
    Replies: 0
    Last Post: Feb 05, 2011, 8:57 AM
  2. Help!!!ComboBox Custom Search 's Problem~
    By st.leo in forum 1.x Help
    Replies: 2
    Last Post: Nov 24, 2010, 9:20 AM
  3. ComboBox Custom Search 's Problem~
    By st.leo in forum 1.x Help
    Replies: 1
    Last Post: Nov 18, 2010, 2:00 AM
  4. ComboBox Custom Search Example
    By Tbaseflug in forum 1.x Help
    Replies: 0
    Last Post: Aug 15, 2009, 10:59 PM
  5. ComboBox Custom Search example
    By echo in forum 1.x Help
    Replies: 1
    Last Post: Jul 01, 2009, 1:27 PM

Posting Permissions