PDA

View Full Version : [CLOSED] Error when da DataSource of GridPanel.Store is empty (datareader datasource)



supera
Jan 31, 2012, 3:23 PM
I am trying to do a generic search control...
For this, I follow two examples:

Grid and Store reconfigure
http://examples2.ext.net/#/GridPanel/Data_Presentation/Grid_and_Store_Reconfigure/

and

System.Data DataReader
http://examples2.ext.net/#/GridPanel/System.Data/DataReader/

It's working beautifully if the datareader contains records... but if datareader returns empty, a error occurs.

3790

The result.script contains this text:


SuperaWeb.SGAC.Dividas.wndDividasDetail_wndEmpresa sSGE_sdtCidade_storeSearchData.proxy.data = ;SuperaWeb.SGAC.Dividas.wndDividasDetail_wndEmpres asSGE_sdtCidade_storeSearchData.load();


The search control code is very complex. It's a little hard for me to have a working example...

So I'd like a hint of what I could do when it comes dataReader empty ... some value that I can set to Store.DataSource or something

Thanks for any help.

Daniil
Jan 31, 2012, 4:27 PM
Hi,

The issue is reproducible by the example below.

We are investigating a possible fix.

Thanks for the report.

Example

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

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

<script runat="server">
protected void DataBind(object sender, DirectEventArgs e)
{
Store store = this.GridPanel1.GetStore();
store.DataSource = new object[] { };
store.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>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:GridPanel ID="GridPanel1" runat="server" AutoHeight="true">
<Store>
<ext:Store 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>
</Store>
<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:Button runat="server" Text="DataBind" OnDirectClick="DataBind" />
</form>
</body>
</html>

Daniil
Jan 31, 2012, 6:30 PM
The fix has been added to SVN and will be available in DP2.

If you need that fix right now, please ask. Though you will need to rebuild the Ext.NET sources.

supera
Feb 01, 2012, 10:02 AM
Hi Daniil...

Thanks to all staff ext.net for the effort and agility with whick problems are solved.

I'm impressed with how things are resolved quickly (2x bugs or my own difficult).

I want the fix now if possible, please!

It only remains for me to put my test project in the Web for tests by our staff.

Thanks a lot...

What should I do? enter in SVC url, download the source and recompile? only this?

Daniil
Feb 01, 2012, 10:58 AM
Thanks to all staff ext.net for the effort and agility with whick problems are solved.

I'm impressed with how things are resolved quickly (2x bugs or my own difficult).

I want the fix now if possible, please!


Thanks a lot for the excellent feedback. We really appreciate it.



It only remains for me to put my test project in the Web for tests by our staff.

Thanks a lot...

What should I do? enter in SVC url, download the source and recompile? only this?

Please follow the steps:

1. Open DP1 Ext.NET solution.

2. Open the
<ext.net.pro.2.0.0.DP1>\Ext.Net\Ext\Data\StoreBase.cs

3. Replace the GetAjaxDataJson method with:

protected virtual string GetAjaxDataJson()
{
if (this.Data != null)
{
return JSON.Serialize(this.Data);
}
return this.DSData != null ? JSON.Serialize(this.DSData) : (this.JsonData.IsNotEmpty() ? this.JsonData : "[]");
}

4. Build the solution.

5. Ensure you use the updated Ext.Net.dll in your project.

supera
Feb 01, 2012, 11:54 AM
Hi Daniil...

StoreBase.GetAjaxDataJson method replaced and solution builted...

Its working very well.

Thanks a lot