Dynamic Store/Grid...see headers, right row count, no data...

  1. #1

    Dynamic Store/Grid...see headers, right row count, no data...

    I have a combobox on a page that will return different datasets based on the selection.
    I'm trying to dynamically create the columns in the store and grid to display results..

    Oddly, I can see the columns, headers etc in the grid..and the grid has the right amount of rows, but I'm not seeing any data!! See attached... I'm sure I'm close!!!!

    Here is the store and grid definition:
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:WarehouseConnectionString %>" SelectCommand="Select ExcelDataId,DataType,Name FROM ExcelData ORDER BY NAME"></asp:SqlDataSource>
        <ext:ScriptManager ID="ScriptManager1" runat="server">
        <ext:Hidden runat="server" id="hidDataType" />
        <ext:Store ID="storeDataType" runat="server" DataSourceId="SqlDataSource1">
                <ext:JsonReader ReaderID="ExcelDataId">
                        <ext:RecordField Name="DataType" Type="String" />
                        <ext:RecordField Name="Name" Type="String" />
        <ext:Store id="Store1" runat="server" autoload="false" AutoDataBind="true" OnSubmitData="Store1_Submit1">
            <AjaxEventConfig isupload="true" />
                        <ext:RecordField Name="FundId" Type="Int" />
        <ext:Panel runat="server" id="pnlExcel">
        <ext:ComboBox runat="server"  id="cmboDataType" StoreID="storeDataType" ValueField="DataType" DisplayField="Name">
                <Select onevent="GetData">  
                <ext:Parameter Name="datatype" Value="#{cmboDataType}.getValue()" Mode="Raw" />
        <ext:GridPanel id="GridPanel1" striperows="true" AutoDataBind="true"    Title="No Report" header="false" trackmouseover="true" runat="server" storeid="Store1" autowidth="true" height="650">
            <SaveMask showmask="false" />
            <LoadMask showmask="true" msg="Fetching Data...." />
            <ColumnModel id="ColumnModel1" runat="server">
                <ext:GroupingView ID="GroupingView1" HideGroupedColumn="true" EmptyGroupText="No Groups" EnableGroupingMenu="true" runat="server" ForceFit="true" StartCollapsed="true" GroupTextTpl='{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})' EnableRowBody="true">
    <GetRowClass Handler="" FormatHandler="False"></GetRowClass>
                <ext:PagingToolbar ID="PagingToolBar1" runat="server" StoreID="Store1" PageSize="50" DisplayInfo="true" DisplayMsg="Displaying Results {0} - {1} of {2}">
                        <ext:ToolbarButton ID="btnToggleGroups" runat="server" Text="Expand/Collapse Groups" Icon="TableSort" Style="margin-left: 6px;" AutoPostBack="false">
                                <Click Handler="#{GridPanel1}.getView().toggleAllGroups();" />
                        <ext:Button ID="Button3" runat="server" Text="To Excel" Icon="PageExcel">
                                <Click Handler="submitValue(#{GridPanel1}, #{FormatType}, 'xls');" />

    Here is the server side method:
       public void GetData(object sender, AjaxEventArgs e)
                string dataType = e.ExtraParams["datatype"];
                DataSet ds = SPs.ExcelData(dataType).GetDataSet();
                //clear out the fields in the current store.
                foreach (DataColumn c in ds.Tables[0].Columns)
                    this.Store1.Reader.Reader.Fields.Add(new RecordField(c.ColumnName));
                Column col = null; 
                foreach (DataColumn c in ds.Tables[0].Columns)
                    col = new Column();
                    col.ColumnID = c.ColumnName;
                    col.Header = c.ColumnName;
                    col.Sortable = true;
                    col.DataIndex = c.ColumnName;
                this.Store1.DataSource = ds;
  2. #2

    RE: Dynamic Store/Grid...see headers, right row count, no data...

    I figured it out..

    this.Store1.AddField(new RecordField(c.ColumnName, RecordFieldType.Auto));
    // this.Store1.Reader.Reader.Fields.Add(new RecordField(c.ColumnName,RecordFieldType.Auto ));

Similar Threads

  1. GridPanel showing data return Store.Count value 0
    By abhi_sheklohiya in forum 1.x Help
    Replies: 3
    Last Post: Mar 26, 2012, 7:06 PM
  2. Replies: 1
    Last Post: Mar 08, 2012, 2:52 PM
  3. Replies: 2
    Last Post: Feb 10, 2011, 6:43 PM
  4. Replies: 1
    Last Post: Nov 25, 2009, 9:09 AM
  5. Dynamic Store/Grid Load on Postback - no data.
    By rthiney in forum 1.x Help
    Replies: 4
    Last Post: Aug 12, 2009, 7:38 AM

Posting Permissions