PDA

View Full Version : [CLOSED] Prevent from autoload store, Autoload = false and still getting reloaded on first entry of page



ViDom
May 16, 2013, 2:18 PM
Hi,
Like in title I've situation that cause autoload of gridpanel store event when I'll apply .AutoLoad property of store to true.
Is there maybe any dependency with some Parameters maybe or something like that?
Store have define httpProxy with jsonreader. Any ideas would be highly appreciated.

Thanks,
ViDom

Daniil
May 16, 2013, 4:00 PM
Hi @ViDom.

Is there a GroupField and a RemoteSort settings of the Store?
https://github.com/extnet/Ext.NET/issues/81

ViDom
May 16, 2013, 6:35 PM
Hi @ViDom.

Is there a GroupField and a RemoteSort settings of the Store?
https://github.com/extnet/Ext.NET/issues/81

There is only RemoteSort setting. I don't add groupfield in tested gridpanel.

Daniil
May 17, 2013, 4:22 AM
I can't reproduce with the test case below. Please provide your one.

Example

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

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ 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 v2 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:GridPanel ID="GridPanel1" runat="server">
<Store>
<ext:Store
runat="server"
OnReadData="Store_ReadData"
PageSize="3"
RemoteSort="true"
AutoLoad="false">
<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>
<ColumnModel runat="server">
<Columns>
<ext:Column runat="server" Text="Test" DataIndex="test" />
</Columns>
</ColumnModel>
<BottomBar>
<ext:PagingToolbar runat="server" />
</BottomBar>
</ext:GridPanel>
</form>
</body>
</html>

ViDom
May 17, 2013, 11:46 AM
I can't reproduce with the test case below. Please provide your one.

Example

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

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ 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 v2 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:GridPanel ID="GridPanel1" runat="server">
<Store>
<ext:Store
runat="server"
OnReadData="Store_ReadData"
PageSize="3"
RemoteSort="true"
AutoLoad="false">
<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>
<ColumnModel runat="server">
<Columns>
<ext:Column runat="server" Text="Test" DataIndex="test" />
</Columns>
</ColumnModel>
<BottomBar>
<ext:PagingToolbar runat="server" />
</BottomBar>
</ext:GridPanel>
</form>
</body>
</html>


Ok I've found out what's was wrong in code behind I've used store.LoadPage(0); which forces request to the handler(when need to get current display page of store).

If you could tell me how can I get number of display page please let me know if I need to make another thread for that ?

Daniil
May 17, 2013, 11:54 AM
Yes, please start a new thread.