PDA

View Full Version : [CLOSED] Question about store



feanor91
Apr 27, 2012, 9:09 AM
Hello

I have a little problem.

I have a lot of data to display. as my data are grouped, I choose to display them in elven grid, representing each one one of the group od data.

For the moment, I have one store per grid, but to optimize data dransfert, I will try to have only one store and diaplaying only relevant data of each gid with that store.

The problem seem to be that I can't set the same store for different grid.

If I try to put it like that :



grdOSA.Store.Add(stoOSA)
grdMASK.Store.Add(stoOSA)


I get an error on execution that said taht the store is already assign

and if I try by the storeID of the grids, I see data in first grid but in the second, all is replaced by "undefined" in value.

Is there a way to achieve that?

And after that, I wish to use again the same store to draw charts.

Daniil
Apr 27, 2012, 10:48 AM
Hi,

Yes, the same Store cannot be added to Store collection of two GridPanels.

So, you are right that you are trying to use StoreID.


and if I try by the storeID of the grids, I see data in first grid but in the second, all is replaced by "undefined" in value.

I am unable to reproduce this problem using the example below. Could you provide a sample?

Example

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

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
this.Store1.DataSource = new object[]
{
new object[] { "test1", "test2", "test3" },
new object[] { "test4", "test5", "test6" },
new object[] { "test7", "test8", "test9" },
};
this.Store1.DataBind();
}
}
</script>

<!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 runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<ext:ResourceManager runat="server" />

<ext:Store ID="Store1" runat="server">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="test1" />
<ext:ModelField Name="test2" />
<ext:ModelField Name="test3" />
</Fields>
</ext:Model>
</Model>
</ext:Store>

<ext:GridPanel runat="server" StoreID="Store1" AutoHeight="true">
<ColumnModel runat="server">
<Columns>
<ext:Column runat="server" Text="Test1" DataIndex="test1" />
<ext:Column runat="server" Text="Test2" DataIndex="test2" />
<ext:Column runat="server" Text="Test3" DataIndex="test3" />
</Columns>
</ColumnModel>
</ext:GridPanel>

<ext:GridPanel runat="server" StoreID="Store1" AutoHeight="true">
<ColumnModel runat="server">
<Columns>
<ext:Column runat="server" Text="Test1" DataIndex="test1" />
<ext:Column runat="server" Text="Test2" DataIndex="test2" />
<ext:Column runat="server" Text="Test3" DataIndex="test3" />
</Columns>
</ColumnModel>
</ext:GridPanel>

</body>
</html>

feanor91
Apr 27, 2012, 11:09 AM
What I want to achieve is that:



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

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
this.Store1.DataSource = new object[]
{
new object[] { "test1", "test2", "test3", "test11", "test21", "test31" },
new object[] { "test4", "test5", "test6", "test41", "test51", "test61" },
new object[] { "test7", "test8", "test9", "test71", "test81", "test91" },
};
this.Store1.DataBind();
}
}
</script>

<!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>Ext.NET v2 Example</title>
</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" />

<ext:Store ID="Store1" runat="server">
<Model>
<ext:Model ID="Model1" runat="server">
<Fields>
<ext:ModelField Name="test1" />
<ext:ModelField Name="test2" />
<ext:ModelField Name="test3" />
<ext:ModelField Name="test4" />
<ext:ModelField Name="test5" />
<ext:ModelField Name="test6" />
</Fields>
</ext:Model>
</Model>
</ext:Store>

<ext:GridPanel ID="GridPanel1" runat="server" StoreID="Store1" AutoHeight="true">
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column ID="Column1" runat="server" Text="Test1" DataIndex="test1" />
<ext:Column ID="Column2" runat="server" Text="Test2" DataIndex="test2" />
<ext:Column ID="Column3" runat="server" Text="Test3" DataIndex="test3" />
</Columns>
</ColumnModel>
</ext:GridPanel>

<ext:GridPanel ID="GridPanel2" runat="server" StoreID="Store1" AutoHeight="true">
<ColumnModel ID="ColumnModel2" runat="server">
<Columns>
<ext:Column ID="Column4" runat="server" Text="Test4" DataIndex="test4" />
<ext:Column ID="Column5" runat="server" Text="Test5" DataIndex="test5" />
<ext:Column ID="Column6" runat="server" Text="Test6" DataIndex="test6" />
</Columns>
</ColumnModel>
</ext:GridPanel>

</body>
</html>


and it works, so I have to find on my side what is wrong.

thanks for your help.

Daniil
Apr 27, 2012, 11:13 AM
I would ensure ModelFields Names and Columns DataIndexes are correct.

feanor91
Apr 27, 2012, 11:22 AM
Yes, you are totaly right, my apologize, when reading you I have just understand that I have not refund the stores in one...

feanor91
Apr 27, 2012, 11:49 AM
Problem related.

Please se that : http://forums.ext.net/showthread.php?18669-Problem-to-get-store-from-code-behind&p=80606#post80606