May 06, 2013, 1:04 AM
[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:
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]