[CLOSED] combox's item can not be selected when the selected item is not the first page?

  1. #1

    [CLOSED] combox's item can not be selected when the selected item is not the first page?

    combox's item can not be select when the selected item is not the first page?

    below is my testcase:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm4.aspx.cs" Inherits="TobrosCWT.BasicInfoSetup.WebForm4" %>
     
    <!DOCTYPE html>
     
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title></title>
        <script type="text/javascript" runat="server">
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!X.IsAjaxRequest)
                {
                    //tfApAccCode.SelectedItems.Add(new Ext.Net.ListItem("test3", "3"));//it can be selected 
                    tfApAccCode.SelectedItems.Add(new Ext.Net.ListItem("test11", "11"));//it can not be selected? why?
                }
            }
     
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <ext:ResourceManager runat="server"></ext:ResourceManager>
                <ext:ComboBox ID="tfApAccCode" runat="server" FieldLabel="Acccout" TypeAhead="false" EmptyText="Please select..." ForceSelection="true" DisplayField="Cname" ValueField="Ccode" MinChars="1" MatchFieldWidth="false" PageSize="10">
                    <Store>
                        <ext:Store ID="store2" runat="server" IsPagingStore="true" PageSize="10">
                            <Model>
                                <ext:Model ID="Model4" runat="server">
                                    <Fields>
                                        <ext:ModelField Name="Ccode" />
                                        <ext:ModelField Name="Cname" />
                                    </Fields>
                                </ext:Model>
                            </Model>
                            <Parameters>
                                <ext:StoreParameter Name="search" Value="#{tfApAccCode}==null?#{tfApAccCode}:#{tfApAccCode}.getValue()" Mode="Raw"></ext:StoreParameter>
                            </Parameters>
                            <Proxy>
                                <ext:AjaxProxy Url="../BasicInfoAshx/Test.ashx">
                                    <ActionMethods Read="GET" />
                                    <Reader>
                                        <ext:JsonReader Root="data" />
                                    </Reader>
                                </ext:AjaxProxy>
                            </Proxy>
                        </ext:Store>
                    </Store>
                    <ListConfig Width="320" Height="300" ItemSelector=".x-boundlist-item">
                        <Tpl ID="Tpl4" runat="server">
                            <Html>
                                <tpl for=".">
                                                                <tpl if="[xindex] == 1">
                                                                    <table class="cbStates-list">
                                                                        <tr>
                                                                            <th>AccCode</th>
                                                                            <th>AccName</th>
                                                                        </tr>
                                                                </tpl>
                                                                <tr class="x-boundlist-item">
                                                                    <td>{Ccode}</td>
                                                                    <td>{Cname}</td>
                                                                </tr>
                                                                <tpl if="[xcount-xindex]==0">
                                                                    </table>
                                                                </tpl>
                                                            </tpl>
                            </Html>
                        </Tpl>
                    </ListConfig>
                </ext:ComboBox>
            </div>
        </form>
    </body>
    </html>
    Test.ashx.cs:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Ext.Net;
     
    namespace TobrosCWT.BasicInfoAshx
    {
        /// <summary>
        /// Test 
        /// </summary>
        public class Test : IHttpHandler
        {
     
            public void ProcessRequest(HttpContext context)
            {
                context.Response.ContentType = "application/json";
     
                var requestParams = new StoreRequestParameters(context);
     
                int start = requestParams.Start;
                int limit = requestParams.Limit;
     
                var data = GetAllAsPaging(start, limit);
                var total = 30;
     
                var suppliers = new Paging<customss>(data, total);
     
                context.Response.Write(JSON.Serialize(suppliers));
            }
     
            private List<customss> GetAllAsPaging(int start, int limit)
            {
                List<customss> o = new List<customss>();
                for (int i = 0; i < 30; i++)
                {
                    customss c = new customss();
                    c.Ccode = i.ToString();
                    c.Cname = "test" + i;
                    o.Add(c);
                }
                return o.Skip(start).Take(limit).ToList<customss>();
            }
     
     
            public bool IsReusable
            {
                get
                {
                    return false;
                }
            }
        }
     
        class customss
        {
            public string Ccode;
            public string Cname;
        }
    }
    thanks.
    Last edited by Daniil; May 21, 2013 at 3:42 AM. Reason: [CLOSED]
  2. #2
    Hi @hdsoso,

    Yes, if you use remote paging (i.e. a Store loads data for the current page only), then an item from non-active page cannot be selected, because it is just absent.
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi @hdsoso,

    Yes, if you use remote paging (i.e. a Store loads data for the current page only), then an item from non-active page cannot be selected, because it is just absent.
    if there is a lot of data , must paging, how to do ? how to locate the page whch is not the first page?can you modify the code above?

    thanks.
  4. #4
    I think the following thread can help you.
    http://forums.ext.net/showthread.php?22653

Similar Threads

  1. Replies: 3
    Last Post: May 06, 2013, 6:44 AM
  2. Replies: 0
    Last Post: Apr 17, 2013, 7:41 AM
  3. Replies: 17
    Last Post: Dec 17, 2012, 11:58 AM
  4. Ext.net Combox Selected item.value in Ext2.0
    By OSSAGHO in forum 2.x Help
    Replies: 5
    Last Post: Aug 08, 2012, 11:04 AM
  5. [CLOSED] Always selected Item is nothing for combobox as menu item
    By rnachman in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 04, 2011, 4:51 PM

Posting Permissions