Get dynamic data before data binds to store and grid

  1. #1

    Get dynamic data before data binds to store and grid

    Hello everyone,

    Is there a way to get my data before it's binded to the reader/store?

    What I'm trying to do: I want to be able to intercept my data from a controller/web service and before its binded to the store/reader/grid, parse the DataTable and create my reader's fields and grid's column model. I can do this easily if I get the DataTable from ViewData[...]. But the data should really be coming from a controller that is executing my model (a report).

    I am using ASP.net MVC.

    Any help please?

    Here is my grid:
                <ext:GridPanel runat="server" ID="ResultsGrid" AutoScroll="true" Title="Results"
                    Region="Center" Margins="5 0 0 0">
                    <TopBar>
                        <ext:Toolbar ID="ResultsToolbar" runat="server" Height="27">
                            <Items>
                                <ext:ToolbarFill ID="ResultsToolbarFill" runat="server" />
                                <ext:Button ID="ResultsRefreshButton" runat="server" Text="Refresh" Icon="Reload">
                                    <Listeners>
                                        <Click Handler="alert('Not yet implemented');" />
                                    </Listeners>
                                </ext:Button>
                            </Items>
                        </ext:Toolbar>
                    </TopBar>
                    <ColumnModel runat="server">
                        <Columns>
                        </Columns>
                    </ColumnModel>
                    <Store>
                        <ext:Store ID="ResultsStore" runat="server">
                            <Reader>
                                <ext:JsonReader>
                                </ext:JsonReader>
                            </Reader>
                            <Proxy>
                                <ext:HttpProxy Url="/Pivot/Execute/" Json="True" Method="GET" OnDataBinding="ConfigureResultsGrid"/>
                            </Proxy>
                        </ext:Store>
                    </Store>
                </ext:GridPanel>
    I've beent trying different events in different places (store/reader/proxy..etc...) Everything seems to fire after I get the data and its bound

    Here is my controller:
     
        [HandleError]
        public class PivotController : Controller
        {
            public string Index()
            {
                return "Default action.";
            }
    
            public ContentResult Execute(PivotReport id)
            {
                DataTable dataTable = new DataTable();
                dataTable.Columns.Add("Temp");
                dataTable.Rows.Add(new object[] {123});
    
                return Content(JSON.Serialize(dataTable));
            }
        }

    Also - quick question - I would be able to bind my PivotReport object as a parameter to be sent to the Execute method above correct? From code behind/DirectMethod?
    Last edited by ckarcz; Mar 08, 2012 at 2:43 PM. Reason: fixed controller results - no more 200 error
  2. #2
    How do I go about getting the data now?
    Last edited by ckarcz; Mar 08, 2012 at 11:16 PM.

Similar Threads

  1. Store Data is not displaying in Dynamic Gridpanel
    By rendongsc in forum 1.x Help
    Replies: 1
    Last Post: Apr 11, 2012, 9:19 PM
  2. Store Data is not displaying in Dynamic Gridpanel
    By NishaLijo in forum 1.x Help
    Replies: 1
    Last Post: Apr 11, 2012, 9:18 PM
  3. [CLOSED] Dynamic Grid not populating data
    By Hari_CSC in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 09, 2010, 3:38 AM
  4. Replies: 1
    Last Post: Oct 27, 2009, 10:39 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