[MVC] Create Grid and add to TabPanel dynamically.

  1. #1

    [MVC] Create Grid and add to TabPanel dynamically.

    Hi All,

    I'm facing the following problem, I need to create Grids dynamically depends on the parameters, in other words for each param combination i'll create different Grids with different columns, for this i've solve my problem creating them on server side like this:

    private GridPanel BuildGridPanel(FuturesPositionOutputParameter futureOut)
            {
                var grid = new GridPanel();
                grid.Store.Add(BuildStore(futureOut.Position));
                grid.SelectionModel.Add(new RowSelectionModel() { Mode = SelectionMode.Single });
                grid.ColumnModel.Add(this.BuildColumns(futureOut.Position.First()).Columns);
                grid.View.Add(new GridView() { StripeRows = true, TrackOver = true });
    
                return grid;
            }
    These parameters is made of a combination of multi selects, meaning that I can create more then one Grid result. to solve this problem i want to create these Grids inside Tabs.

    And now my question, how can i create TabPanels in server side and add one Grid.
    And return all these Data to for the Ext can render.
    "List of Tabs and for each tab i need a Grid inside"

    To illustrate my question:

    the User selected 2 items on parameters, that means the solution will show for him 2 Tabs and for each tab one grid with the corresponding data.

    Regards,
  2. #2
  3. #3
    Hi Vladimir,
    Thanks for your reply, I could solve my problem:

    Index.cshtml

    Button:
    .Buttons(Html.X()
                        .Button()
                        .Text("Generate")
                        .ID("btnGenerate")
                        .DirectEvents(de =>
                        {
                            de.Click.Url = Url.Action("AddTab");
    
                        })
                   )
    TabPanel (inside FormPanel > Items):
    Html.X().TabPanel()
                            .ID("TabPanel1")
                            .Layout(LayoutType.Fit)
                            .Width(1000)
                            .Height(550)
    Controller.cs
    public ActionResult AddTab(MyParamType futureOut)
    {
            this.BuildGridPanel(futureOut).AddTo("TabPanel1");
                
            return this.Direct();
    }
    This way i can create my Tabs dynamically for each Grid that i want.

    But i still have one question, how can i manipulate my tabs on server side, for example, my tabs comes without .Title
    I need to do this before my "AddTo("TabPanel1")" ? but how?

    Regards
  4. #4
    Hi all,

    I guess this tread can be closed, i've found how i can add the titles to my Tabs.

    In the BuildGridPanel Method just need to add this property:

    grid.Title = "My Title";
    Regads,

Similar Threads

  1. Create Textfield dynamically ? please help
    By nazmulrockon in forum 2.x Help
    Replies: 3
    Last Post: Aug 28, 2012, 7:58 AM
  2. create groupcommands dynamically
    By oscar_nadie in forum 1.x Help
    Replies: 1
    Last Post: Apr 09, 2011, 9:03 PM
  3. How to create dynamically Menupanel
    By krishna in forum 1.x Help
    Replies: 1
    Last Post: Mar 31, 2011, 5:37 AM
  4. Create portlet dynamically
    By vimaln in forum 1.x Help
    Replies: 3
    Last Post: Mar 13, 2009, 7:59 PM
  5. How to Create a portlet dynamically?
    By mohan.kantipudi in forum 1.x Help
    Replies: 0
    Last Post: Jan 16, 2009, 2:11 AM

Tags for this Thread

Posting Permissions