Apr 11, 2012, 7:17 PM
[CLOSED] Infinite Scrolling with MVC
Hi folks, i´m trying to implement a Grid with infinite scrolling using mvc. I tried to do it using https://examples2.ext.net/#/GridPane.../Forum_topics/ as example but i was not able to accomplish this task
The function LoadRecords is called but the records are loaded in the grid.
Could someone give me directions to overcome this problem?
Thanks in advance
View
The function LoadRecords is called but the records are loaded in the grid.
Could someone give me directions to overcome this problem?
Thanks in advance
View
<ext:Panel ID="Panel1" runat="server" PreventHeader="true" Border="false">
<Loader ID="Loader1" runat="server" Mode="Component" AutoLoad="true" Url="/Example/Internal/">
<Params>
<ext:Parameter Name="containerId" Value="Panel1" Mode="Value" />
</Params>
<LoadMask ShowMask="true" />
</Loader>
</ext:Panel>
Interface Generatorpublic ContentResult Internal(string containerId)
{
//Grid
GridPanel grd = new GridPanel { ID = "_grd", Title = "example", Height = 200 };
grd.Listeners.AfterRender.Handler = "alert('Saldanha'); var me = this; me.store.prefetch({start: 0, limit: 99, callback: function() { me.store.guaranteeRange(0, 49); }});";
grd.Listeners.AfterRender.Delay = 100;
//Proxy
JsonPProxy proxy = new JsonPProxy();
proxy.Reader.Add(new JsonReader { Root = "data", TotalProperty = "total" });
proxy.Url = "/Example/Test/";
//Store
Store str = new Store { ID = "_str", AutoLoad = false, Buffered = true };
str.Proxy.Add(proxy);
grd.Store.Add(str);
//Model
Model mdl = new Model { IDProperty = "ID" };
addColumn("ID", grd, mdl);
addColumn("Name", grd, mdl);
str.Model.Add(mdl);
//Result
ContentResult r = new ContentResult();
r.Content = ComponentLoader.ToJson(grd);
return r;
}
private void addColumn(string id, GridPanel grd, Model mdl)
{
ModelField mdf = new ModelField(id);
Column cln = new Column { ID = id, DataIndex = id, Sortable = true, Text = string.Format("_cln{0}", id) };
if (id == "ID")
{
mdl.IDProperty = id;
}
mdl.Fields.Add(mdf);
grd.ColumnModel.Columns.Add(cln);
}
Data Loadpublic StoreResult Test(int start, int limit)
{
List<Person> lst = new List<Person>();
for (int index = 0; index < limit; index++)
{
lst.Add(new Person { ID = index, Name = "Ext" + (start + index) });
}
return new StoreResult(lst, limit);
}
Entitypublic class Person
{
public int ID { get; set; }
public string Name { get; set; }
}
Last edited by Daniil; Apr 12, 2012 at 6:29 PM.
Reason: [CLOSED]