PDA

View Full Version : ComboBox lose value with remote paging



GRISSA
Jul 03, 2015, 11:50 AM
Hi,

I want to create a combobox with remote paging but i found a problem that the comboBox lose the selected value when i pass to next page.
I tested the solution in this link https://www.sencha.com/forum/showthread.php?269445-4.2.1-GA-ComboBox-lose-value-with-remote-paging
but didn't work with me.

Please help me.

Daniil
Aug 21, 2015, 9:40 AM
Hi @GRISSA,

Welcome to the Ext.NET forums!

Yes, it is an issue in Ext.NET v2.
https://github.com/extnet/Ext.NET/issues/318

But I could not reproduce it in v3 with the sample below. Can you reproduce?

Example

<%@ Page Language="C#" %>

<%@ Import Namespace="System.Collections.Generic" %>

<script runat="server">
public List<object> MyData = new List<object>
{
new { test = "test1" },
new { test = "test2" },
new { test = "test3" },
new { test = "test4" },
new { test = "test5" },
new { test = "test6" },
new { test = "test7" },
new { test = "test8" },
new { test = "test9" }
};

protected void Store_ReadData(object sender, StoreReadDataEventArgs e)
{
List<object> data = this.MyData;
var limit = e.Limit;
if ((e.Start + e.Limit) > data.Count)
{
limit = data.Count - e.Start;
}
List<object> rangeData = (e.Start < 0 || limit < 0) ? data : data.GetRange(e.Start, limit);
e.Total = data.Count;
(sender as Store).DataSource = rangeData;
}
</script>

<!DOCTYPE html>

<html>
<head runat="server">
<title>Ext.NET v3 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:ComboBox
runat="server"
PageSize="3"
DisplayField="test"
Width="300">
<Store>
<ext:Store runat="server" OnReadData="Store_ReadData" PageSize="3">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="test" />
</Fields>
</ext:Model>
</Model>
<Proxy>
<ext:PageProxy>
<Reader>
<ext:JsonReader />
</Reader>
</ext:PageProxy>
</Proxy>
</ext:Store>
</Store>
</ext:ComboBox>
</form>
</body>
</html>