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

  1. #1

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

    I am trying to do a generic search control...
    For this, I follow two examples:

    Grid and Store reconfigure
    https://examples2.ext.net/#/GridPane...e_Reconfigure/

    and

    System.Data DataReader
    https://examples2.ext.net/#/GridPane...ta/DataReader/

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

    Attachment 3790

    The result.script contains this text:
    SuperaWeb.SGAC.Dividas.wndDividasDetail_wndEmpresasSGE_sdtCidade_storeSearchData.proxy.data = ;SuperaWeb.SGAC.Dividas.wndDividasDetail_wndEmpresasSGE_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.
    Last edited by Daniil; Feb 01, 2012 at 11:59 AM. Reason: [CLOSED]
  2. #2
    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>
  3. #3
    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.
  4. #4
    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?
  5. #5
    Quote Originally Posted by supera View Post
    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.

    Quote Originally Posted by supera View Post
    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.
  6. #6
    Hi Daniil...

    StoreBase.GetAjaxDataJson method replaced and solution builted...

    Its working very well.

    Thanks a lot

Similar Threads

  1. GridPanel, Store, DataSource - passing Keys
    By alexua in forum 2.x Help
    Replies: 0
    Last Post: Jul 16, 2012, 8:10 PM
  2. Gridpanel with datasource shows empty rows
    By darylpeeters in forum 2.x Help
    Replies: 2
    Last Post: May 31, 2012, 1:03 PM
  3. [CLOSED] ComboBox / Store / DataSource : Store.DataSource is NULL
    By wagger in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Apr 24, 2011, 10:09 AM
  4. Replies: 1
    Last Post: Jul 23, 2010, 10:02 PM
  5. Replies: 0
    Last Post: Jun 26, 2009, 11:32 AM

Posting Permissions