[CLOSED] Reload a grid store from a window - MVC

  1. #1

    [CLOSED] Reload a grid store from a window - MVC

    I have a grid with records and the edit of these records is in Window. On Save button click on the Window direct event I go back to the controller method to save the record and I have this in the controller method

    var store = this.GetCmp<Store>("RecordsGridStore");
    store.Reload();
    The message that I get in the browser is: Cannot read property 'reload' of undefined

    In this scenario above, how do you reload a grid store from MVC method?

    Thank you
    Last edited by Daniil; May 13, 2015 at 8:22 AM. Reason: [CLOSED]
  2. #2
    Hi @registrator,

    In this scenario above, how do you reload a grid store from MVC method?
    A Store's .Reload() call is going to work if the Store has a remote proxy associated to it. Has it?

    The message that I get in the browser is: Cannot read property 'reload' of undefined
    Please provide a test case to reproduce.
  3. #3
    Hi Daniil

    this is the grid and store definition. I cannot get it to reload.

                    X.GridPanel()
                        .EnableColumnHide(false)
                        .ID("GridCustomers")
                        .Store(
                            X.Store()
                            .ID("SalesRecordsGridStore")
                            .Data(Model)
                            .AutoLoad(true)
                            .Proxy(
                                Html.X().AjaxProxy()
                                    .Url(Url.Action("GetList", "List", new { area = "SalesRecord" }))
                                    .Reader(Html.X().JsonReader().Root("data"))
                            )
                            .Model(
                                X.Model()
                                .Name("Invoce")
                                .IDProperty("ACCOUNT_REF")
                                .Fields(
                                    X.ModelField()
                                        .Name("NAME")
                                        .Type(ModelFieldType.String),
                                    X.ModelField()
                                        .Name("ACCOUNT_REF")
                                        .Type(ModelFieldType.String),
                                    X.ModelField()
                                        .Name("BALANCE")
                                        .Type(ModelFieldType.Float),
                                    X.ModelField()
                                        .Name("CREDIT_LIMIT")
                                        .Type(ModelFieldType.Float),
                                    X.ModelField()
                                        .Name("CONTACT_NAME")
                                        .Type(ModelFieldType.String),
                                    X.ModelField()
                                        .Name("TELEPHONE")
                                        .Type(ModelFieldType.String)
                                )
                            )
                            .Sorters(X.DataSorter().Property("NAME").Direction(Ext.Net.SortDirection.ASC))
                            .Listeners( l => {
                                l.Load.Handler = "sum(App.GridCustomers);";
                            })
                        )
                        .ColumnModel(X.Column().Text("A/C").DataIndex("ACCOUNT_REF").Flex(1),
                                    X.Column().Text("Name").DataIndex("NAME").Renderer("companyNameColor").Flex(1),
                                    X.NumberColumn().Text("Balance").DataIndex("BALANCE").Renderer("balanceColor").Align(Alignment.Right).Flex(1),
                                    X.NumberColumn().Text("Credit Limit").DataIndex("CREDIT_LIMIT").Align(Alignment.Right).Flex(1),
                                    X.Column().Text("Contact Name").DataIndex("CONTACT_NAME").Flex(1),
                                    X.Column().Text("Telephone").DataIndex("TELEPHONE").Flex(1)
                        )
                        .SelectionModel(Html.X().RowSelectionModel().Mode(SelectionMode.Simple))
                        .Features(X.GridFilters()
                                    .Local(true)
                                    .ID("GridFilters1")
                                    .Filters(
                                        X.StringFilter().DataIndex("ACCOUNT_REF"),
                                        X.StringFilter().DataIndex("NAME"),
                                        X.NumericFilter().DataIndex("BALANCE"),
                                        X.NumericFilter().DataIndex("CREDIT_LIMIT"),
                                        X.StringFilter().DataIndex("CONTACT_NAME"),
                                        X.StringFilter().DataIndex("TELEPHONE")
                                   )
                                    .Listeners(l => l.FilterUpdate.Handler = "sum(App.GridCustomers);")
                        )
    var store = this.GetCmp<Store>("SalesRecordsGridStore");
                        store.Reload();
  4. #4
    Hi
    May be bellow code solve your problem

    Set ServerProxy instead Proxy .
  5. #5
    No, I get nothing in the grid if I do that.
    Thnx
  6. #6
    Hi
    I think you you should remove .Data(Model) and load the grid with Serverproxy only.
  7. #7
    there is nothing in the grid again if I do that
  8. #8
    @registrator, is that helpful?
    http://forums.ext.net/showthread.php...l=1#post166961

    If the issue persists, please provide a full test case to reproduce.
  9. #9
    This is an architecture issue. I will explain. Since my solution is based on your mvc examples solution, i have the edit form opening on top of the tabs and that is why the reload does not see the store.
    I will need to change my edit window structure not to open it on top of tabs but inside.

Similar Threads

  1. Replies: 2
    Last Post: Sep 17, 2014, 8:41 PM
  2. Replies: 1
    Last Post: Nov 07, 2013, 8:27 PM
  3. reload store (grid) from treepanel
    By simbal in forum 1.x Help
    Replies: 1
    Last Post: Apr 28, 2012, 9:57 AM
  4. [CLOSED] Update grid cell value without store.reload()
    By pj_martins in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Nov 02, 2011, 3:54 PM
  5. Replies: 2
    Last Post: Apr 08, 2011, 12:22 PM

Posting Permissions