Jan 04, 2017, 3:43 PM
[CLOSED] TreePanel local sort is scrolling to top
The scrollbar is positioning at the top when sorting locally. See the following example:
I think it's a bug. Considering a change of some value in a row or deleting it and then sort.. I will have to scroll down and find the row again if I want review. On previous versions I can preserve the scrollbar position using the "preserveScrollOnRefresh" option.
Please, let me know what do you think about this.
Best Regards.
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<!DOCTYPE html>
<html>
<head runat="server">
<script type="text/javascript">
var click = function (btn) {
var tree = btn.up('panel');
tree.store.sort('ID', 'ASC');
}
</script>
</head>
<body>
<ext:ResourceManager runat="server" />
<ext:TreePanel RootVisible="false" Title="Ext.Net" Border="true" Height="400" Width="300" runat="server">
<Store>
<ext:TreeStore runat="server">
<Proxy>
<ext:AjaxProxy Url="~/Example/LoadTreeFakeChildren">
<Reader>
<ext:JsonReader RootProperty="data" />
</Reader>
</ext:AjaxProxy>
</Proxy>
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="ID" Type="Int" />
<ext:ModelField Name="Name" />
</Fields>
</ext:Model>
</Model>
</ext:TreeStore>
</Store>
<Root>
<ext:Node NodeID="0" Text="Root" />
</Root>
<ColumnModel>
<Columns>
<ext:Column Text="ID" DataIndex="ID" runat="server" />
<ext:TreeColumn Text="Name" DataIndex="Name" Flex="2" runat="server" />
</Columns>
</ColumnModel>
<View>
<ext:TreeView DeferEmptyText="false" />
</View>
<Buttons>
<ext:Button Text="Click Me" runat="server">
<Listeners>
<Click Handler="click(item);" />
</Listeners>
</ext:Button>
</Buttons>
</ext:TreePanel>
</body>
</html>
public class ExampleController : Controller
{
public ActionResult Index()
{
return View();
}
public StoreResult LoadTreeFakeChildren()
{
var nodes = new NodeCollection();
for (int index = 1; index < 1001; index++)
{
Node no = new Node();
no.NodeID = $"{index}{DateTime.Now.Second}";
no.CustomAttributes.Add(new ConfigItem { Name = "ID", Value = index.ToString(), Mode = ParameterMode.Value });
no.CustomAttributes.Add(new ConfigItem { Name = "Name", Value = $"Name - {index}", Mode = ParameterMode.Value });
nodes.Add(no);
}
return new StoreResult { Data = nodes.ToJson() };
}
}
Here is another piece of code using only Ext JS 5.1.3.I think it's a bug. Considering a change of some value in a row or deleting it and then sort.. I will have to scroll down and find the row again if I want review. On previous versions I can preserve the scrollbar position using the "preserveScrollOnRefresh" option.
Please, let me know what do you think about this.
Best Regards.
Last edited by fabricio.murta; Feb 11, 2017 at 1:45 AM.