Aug 13, 2013, 9:13 AM
[CLOSED] Custom Search Combobox setValue not Working in Ext 2.2
i have created custom search combobox
in combobox's render listener i am setting the combobx value by
setValue and setRawValue
it is working but when i press down arrow key the value which i have set
is not selected (it is working properly in version 1.1)
as per documented for combobox
setvalue method fires events -
change
dirtychange
validitychange
how to prevent for firing the change event?
it is not working by using suspendEvents() and resumeEvents() in ie
how to achieve it?
In Ext.net 1.1
in combobox's render listener i am setting the combobx value by
setValue and setRawValue
it is working but when i press down arrow key the value which i have set
is not selected (it is working properly in version 1.1)
as per documented for combobox
setvalue method fires events -
change
dirtychange
validitychange
how to prevent for firing the change event?
it is not working by using suspendEvents() and resumeEvents() in ie
how to achieve it?
In Ext.net 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>
In Ext.net 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>
Protected void setCmbValue()
{
ddlStore.DataSource = lstVal;
ddl.Listeners.Render.Handler = "this.setValue('" + lstVal[0].ID + "');this.setRawValue('" + lstVal[0].Name + "');";
ddl.Listeners.Render.Delay = 1;
ddlStore.DataBind();
}
Filter.ashxpublic 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);
}
Last edited by Daniil; Aug 20, 2013 at 9:09 AM.
Reason: [CLOSED]