PDA

View Full Version : [CLOSED] Buffered store not loading all records



RCM
Mar 13, 2014, 3:28 AM
Good day,

I am using the buffered store feature to try and load over a 100,000 records in the gridpanel, but the store is only loading up to 70,000 records. Please let me know if I am doing something wrong. I am using using the ext.net release version: 2.1.0.27032 and I am not able to upgrade to the latest release at this moment in time. Please offer some assistance.

see my sample code below:


View:


<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<meta content="NO-CACHE" http-equiv="CACHE-CONTROL" />
<%-- Override the default label seperator and set to ""--%>
<ext:ResourcePlaceHolder runat="server" Mode="ScriptFiles" />
<script type="text/javascript">
Ext.Component.prototype.labelSeparator = "";
</script>
<script src="/Scripts/GridView.js" type="text/javascript"></script>
</head>
<body>
<ext:ResourceManager runat="server">
<Listeners>

</Listeners>
</ext:ResourceManager>
<ext:Viewport ID="viewportResultView" runat="server" Layout="FitLayout" IDMode="Static">
<Items>
<ext:GridPanel ID="gridPanelGridView" runat="server" Region="Center">
<TopBar>
</TopBar>
<SelectionModel>
<ext:RowSelectionModel runat="server" PruneRemoved="false" Mode="Multi" />
</SelectionModel>
<ColumnModel>
<Columns>
<ext:RowNumbererColumn runat="server" Width="50" Sortable="false" />
</Columns>
<Listeners>
</Listeners>
</ColumnModel>
<Store>
<ext:Store runat="server" Buffered="true" PageSize="5">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="dummy" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<Features>
<ext:GridFilters runat="server" ID="gridFiltersGridView" Local="false" MenuFilterText="temp" ParamPrefix = "filter"
AutoDataBind="true" >
<Filters>
<ext:BooleanFilter />
</Filters>
<Listeners>

</Listeners>
</ext:GridFilters>
</Features>
<Listeners>
<CellDblClick Fn="" />
<ContainerContextMenu Fn="" />
<ViewReady Handler="GridView.InitializeView();" />
</Listeners>
</ext:GridPanel>
</Items>
<Listeners>
<Render />
</Listeners>
</ext:Viewport>
</body>
</html>


Controller:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Ext.Net.MVC;


namespace MvcApplication1.Controllers
{
public class GridController : Controller
{
//
// GET: /Grid/

public ActionResult Index()
{
return View();
}


public StoreResult GetData(int start, int limit, int page, string filter)
{
StoreResult response = new StoreResult();

List<User> data = new List<User>();

Random randow = new Random();
DateTime now = DateTime.Now;

for (int i = start + 1; i <= start + limit; i++)
{
User user = new User()
{
Age = i,
Count = + i + 10,
};

data.Add(user);
}

response.Data = data;
response.Total = 150000;

return response;
}

}

public class User
{
public int Age { get; set; }

public int Count { get; set; }
}
}



Javascript:



GridView = {

InitializeView: function () {

Ext.ux.grid.filter.NumericFilter.override({
createMenu: function (config) {
var me = this,
menuCfg = config.menuItems ? { items: config.menuItems} : {},
menu;

if (Ext.isDefined(config.emptyText)) {
menuCfg.menuItemCfgs = {
emptyText: config.emptyText,
selectOnFocus: false,
width: 155
};
}

//added
if (config.fieldCfg) {
menuCfg.fieldCfg = config.fieldCfg;
}
//end of added

menu = Ext.create('Ext.ux.grid.menu.RangeMenu', menuCfg);
menu.on('update', me.fireUpdate, me);
return menu;
}
});

GridView.ReconfigureGrid();
},


ReconfigureGrid: function () {
var columns = [{ text: 'Age', dataIndex: 'Age' }, { text: 'Count', dataIndex: 'Count', }];
var fields = [{ name: 'Age', type: 'int' }, { name: 'Count', type: 'int'}];



var grid = App.gridPanelGridView;

var store = grid.store;
var oldStore = store;

store.removeAll();
store = GridView.CreateStore(fields);


grid.reconfigure(store, columns);
GridView.SetGridFilters(columns, fields, store);

store.loadPage(1);
},



CreateStore: function (fields) {

return Ext.create('Ext.data.JsonStore', {
remoteSort: true,
remoteFilter: true,
buffered: true,
fields: fields,
autoLoad: false,
pageSize: 500,
showWarningOnFailure: true,
proxy: {
type: "ajax",
url: "/Grid/GetData",
reader: {
root: "data",
type: "json",
totalProperty: 'total'
},
listeners: {
exception: { fn: function (el, response, operation, eOpts) {

alert(response.text);

}
}//end exception
}
},
listeners: {
}
});
},

SetGridFilters: function (columns, fields, store) {


App.gridPanelGridView.filters.clearFilters();
for (var i = 0; i < columns.length; i++) {
for (var j = 0; j < fields.length; j++) {
if (columns[i].dataIndex == fields[j].name) {
var fieldCfg = { lt: { allowDecimals: true, decimalPrecision: 5 }, gt: { allowDecimals: true, decimalPrecision: 5 }, eq: { allowDecimals: true, decimalPrecision: 5} };
App.gridPanelGridView.filters.addFilter({ dataIndex: columns[i].dataIndex, type: fields[j].type, fieldCfg: fieldCfg });
break;
}
}
}

App.gridFiltersGridView.bindStore(store);
}
}

Daniil
Mar 13, 2014, 6:09 AM
Hi @RCM,

Unfortunately, it is still a problem in IE with the latest Ext.NET release. Though it appears to be working in FireFox and Chrome.

I am afraid we don't have a solution.