Reload Store of GridPanel with DirectEvent Method

  1. #1

    Reload Store of GridPanel with DirectEvent Method

    hi,
    i got a GridPanel as follows:

    Html.X().GridPanel()
                                .Title("Dateien")
                                .Width(600)
                                .Height(350)
                                .ID("Grid")
                                .Store(Html.X().Store()
                                    .ID("TableStore")
                                    .Model(Html.X().Model()
                                        .Fields(
                                            new ModelField("FullName", ModelFieldType.String),
                                            new ModelField("Name", ModelFieldType.String),
                                            new ModelField("Length", ModelFieldType.Int),
                                            new ModelField("CreationTime", ModelFieldType.String)
                                        )
                                            )
                                    .DataSource(Model.getObj())
                                )
                                .ColumnModel(
                                            Html.X().Column().Text("FullName").DataIndex("FullName"),
                                            Html.X().Column().Text("Name").DataIndex("Name"),
                                            Html.X().Column().Text("Length").DataIndex("Length"),
                                            Html.X().Column().Text("CreationTime").DataIndex("CreationTime")
                                )
    by clicking on a node in a TreePanel, i call a Method in the controller to fill the GridPanel with data. (Model.getObj() is at the beginning an empty list) :

    public ActionResult GetGridPanel(string path)
            {
                Store store = this.GetCmp<Store>("TableStore");
                FolderDataModel model = new FolderDataModel();
                model.setObj(FolderDataModel.GetFiles(path));
                store.DataSource = model.getObj();
                store.DataBind();
                return this.Direct();
            }
    model.getObj() receives - when i debug - the filled List of Objects. The question is now how can i load this store / List into the GridPanel's store?
    My attempt fails.

    Regards

    EDIT: when i debug with firebug, i get the error msg:
    ReferenceError: App is not defined
    Last edited by novacp; Feb 12, 2014 at 1:32 PM. Reason: Error message
  2. #2
    i did it now exactly like in the examples but it does not work :


    script:

     var onSuccess = function (grid, data) {
                grid.show();
                grid.getStore().loadData(data);
            };
    direct event on node:

    .DirectEvents(de =>
                                {
                                    de.ItemClick.Url = "/FolderData/GetGridPanel";
                                    de.ItemClick.ExtraParams.Add(new Parameter("path", "/test/docs/"));
                                    de.ItemClick.Success = "onSuccess(App.Grid, result.data);";
                                })
    GridPanel:

    Html.X().GridPanel()
                                .Title("Dateien")
                                .Width(600)
                                .Height(350)
                                .ID("Grid")
                                .Store(Html.X().Store()
                                    .Model(Html.X().Model()
                                        .Fields(
                                            new ModelField("FullName", ModelFieldType.String),
                                            new ModelField("Name", ModelFieldType.String),
                                            new ModelField("Length", ModelFieldType.Int),
                                            new ModelField("CreationTime", ModelFieldType.String)
                                        )
                                            )
                                    .DataSource(Model.getObj())
                                )
                                .ColumnModel(
                                            Html.X().Column().Text("FullName").DataIndex("FullName"),
                                            Html.X().Column().Text("Name").DataIndex("Name"),
                                            Html.X().Column().Text("Length").DataIndex("Length"),
                                            Html.X().Column().Text("CreationTime").DataIndex("CreationTime")
                                )
    Method in Controller:

    public ActionResult GetGridPanel(string path)
            {
                FolderDataModel model = new FolderDataModel();
                model.setObj(FolderDataModel.GetFiles(path));
                return this.Store(model.getObj());
            }
    i still get the error :
    Reference App not defined
  3. #3
    fixed with help from http://stackoverflow.com/questions/8...-to-get-a-grid

    how can i pass the id of the clicked node in:

     de.ItemClick.ExtraParams.Add(new Parameter("path", HERE ID ));
    Last edited by novacp; Feb 12, 2014 at 3:05 PM.
  4. #4
    fixed that issue. can be [CLOSED]

Similar Threads

  1. Replies: 1
    Last Post: Nov 07, 2013, 8:27 PM
  2. [CLOSED] Store reload makes scrollbars appear in gridpanel
    By ingo.bleile in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Feb 14, 2013, 6:20 AM
  3. [CLOSED] Adding a button directevent in a directevent method
    By ogokgol in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 31, 2011, 10:29 AM
  4. Replies: 3
    Last Post: Oct 08, 2009, 11:57 AM
  5. Databind / Reload Store and GridPanel Problem
    By locoperoguapo in forum 1.x Help
    Replies: 5
    Last Post: Feb 10, 2009, 9:23 AM

Posting Permissions