PDA

View Full Version : [CLOSED] Is there any method to fetch previously loaded records along with the newly loaded records



Tarun_Chand
Mar 20, 2013, 2:01 PM

Daniil
Mar 20, 2013, 4:06 PM
Hi Tarun Chand,

Do you use the latest sources from the trunk?

Recently, I worked on a similar issue and it appears to maintain selection fine across the pages if PruneRemoved="false".

If you use the latest, please provide a full test case to reproduce.

Tarun_Chand
Mar 21, 2013, 1:33 PM

Daniil
Mar 21, 2013, 3:29 PM

Tarun_Chand
Mar 22, 2013, 5:27 AM
It forces to be false for a buffered store.
http://docs.sencha.com/ext-js/4-2/#!/api/Ext.selection.CheckboxModel-cfg-showHeaderCheckbox



Is it reproducible in all browsers? Could you provide a sample to reproduce?

Hi Daniil, I tried in IE 8 and Mozilla Firefox , the same issue is occuring in both the browsers.

PFA sample.

Daniil
Mar 22, 2013, 6:39 AM
Thank you.

Please post the sample directly here wrapping in [CODE] tags.

Also please make a standalone ASPX page putting the code behind directly to ASPX page.
Forum Guidelines For Posting New Topics

(http://forums.ext.net/showthread.php?3440)No need to create a new post, please edit the existing one.

Tarun_Chand
Mar 25, 2013, 10:36 AM
Hi Daniil, as suggested by you, posting the sample directly here wrapping in [CODE] tags.

PFA sample.

CS


public partial class Scrolling : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Session["SummaryData"] = GetTabGridData();
CreateColumns((DataTable)Session["SummaryData"]);
BindStore((DataTable)Session["SummaryData"]);

}

private void CreateColumns(DataTable dtTabs)
{
GridPanel1.ColumnModel.Columns.Clear();

for (int j = 0; j < dtTabs.Columns.Count; j++)
{
Ext.Net.Column col = new Ext.Net.Column();

col.ID = GridPanel1.ID + "_Col_" + j.ToString();
col.Text = dtTabs.Columns[j].ToString();
col.DataIndex = dtTabs.Columns[j].ToString();
GridPanel1.ColumnModel.Columns.Add(col);
}
}
private void BindStore(DataTable dtTabs)
{
JsonReader ar = new JsonReader();
Store store = GridPanel1.GetStore();


store.Model.Clear();
Model model = null;
if (store.Model.Count > 0)
model = store.Model[0];
else
{
model = new Model();
model.ID = "Model_" + store.ID;
}

for (int i = 0; i < dtTabs.Columns.Count; i++)
{
ModelField mf = new ModelField(dtTabs.Columns[i].ToString());

model.Fields.Add(mf);

}

store.Model.Add(model);
}

protected void Store_ReadData(object sender, StoreReadDataEventArgs e)
{
Store store = (Store)sender;

int start = e.Start,
limit = e.Limit;
Random randow = new Random();
DateTime now = DateTime.Now;
DataTable dtGridData = (Session["SummaryData"] != null) ? (DataTable)Session["SummaryData"] : GetTabGridData();
Session["SummaryData"] = dtGridData;

DataTable data = new DataTable();
data = dtGridData.Clone();
//for (int i = start + 1; i <= start + limit; i++)
int indexLimit = (start + limit) > dtGridData.Rows.Count ? dtGridData.Rows.Count : start + limit;

for (int i = start; i < indexLimit; i++)
{
DataRow dr = dtGridData.Rows[i];

data.ImportRow(dr);
}
store.Data = data;
store.DataBind();
e.Total = dtGridData.Rows.Count;
}

private DataTable GetTabGridData()
{

DataTable dtTabs = new DataTable();

dtTabs.Columns.Add("Employee");
dtTabs.Columns.Add("Department");
dtTabs.Columns.Add("Area");
dtTabs.Columns.Add("Country");

for (int i = 0; i < 5000; i++)
{
DataRow dr = dtTabs.NewRow();

dr["Employee"] = "Employee_" + (i.ToString());
dr["Department"] = (i % 2 == 0) ? true : false;
dr["Area"] = "City_" + (i.ToString());
dr["Country"] = "Country_" + (i.ToString());
dtTabs.Rows.Add(dr);
}

return dtTabs;
}
}



ASPX



<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Scrolling.aspx.cs" Inherits="Scrolling" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form2" runat="server">
<div>
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Window ID="Window1" runat="server" Title="Adding tab" Width="700" Height="600"
Icon="Link" Layout="BorderLayout" MaskDisabled="false">
<items>
<ext:Panel ID="pnl1" runat="server" Closable="false">
<Items>
<ext:GridPanel ID="GridPanel1" runat="server" Width="500" Height="500" DisableSelection="false">
<Store>
<ext:Store ID="store1" runat="server" Buffered="true" PageSize="50" TrailingBufferZone="10"
LeadingBufferZone="10" OnReadData="Store_ReadData">
<Proxy>
<ext:PageProxy>
<Reader>
<ext:JsonReader Root="data" />
</Reader>
</ext:PageProxy>
</Proxy>

<Model>
<ext:Model ID="Model1" runat="server">
<Fields>
<ext:ModelField Name="Employee" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column ID="Column1" runat="server" Text="Employee" DataIndex="Employee">
</ext:Column>
</Columns>
</ColumnModel>
<Features>
<ext:GridFilters ID="gridFilter" runat="server" >
<Filters>
<ext:ListFilter DataIndex="Employee" StoreID="store1" LabelField="test">
</ext:ListFilter>
</Filters>
</ext:GridFilters>
</Features>
<SelectionModel>
<ext:CheckboxSelectionModel runat="server" PruneRemoved="false"></ext:CheckboxSelectionModel>
</SelectionModel>
</ext:GridPanel>
</Items>
</ext:Panel>
</items>
</ext:Window>
</div>
</form>
</body>
</html>

Daniil
Mar 25, 2013, 12:02 PM
Thank, but seems you missed this comment.

No need to create a new post, please edit the existing one.

Well, no problem, let's leave the things as they are.

I am unable to reproduce the problem. I tested in FireFox and IE9. It allows to select/check rows without an error.

Also to run your sample I had to remove the GridFilters because of its ListFilter throws the "this.store is undefined" JavaScript error.

This leads me to assume that you are reproducing the problem with another sample (maybe, your real page). So, please ensure the sample you posted does reproduce the issue.