[CLOSED] Add panel with tabmenu in AjaxResult

  1. #1

    [CLOSED] Add panel with tabmenu in AjaxResult

    Hi guys,

    I 'd like to dynamically add a panel with a tabMenu in Ajax. Actually, I can add my panel without my tabMenu.

    My ajaxresult function

         public AjaxResult AddDashTab(string url, string idTab, string title)
            {
                AjaxResult response = new Ext.Net.MVC.AjaxResult();
                var tabPanel = this.GetCmp<TabPanel>("PanelTab");
                Panel panel = new Panel { ID = idTab, Title = title, IconCls = "DashboardIcon", Closable = true, Border = false, Layout = LayoutType.Fit.ToString() };
                ComponentLoader loader = new ComponentLoader { Url = url, Mode = LoadMode.Frame };
                loader.LoadMask.ShowMask = true;
                loader.LoadMask.Msg = _resourcesService.GetResource("Javascript", "PreparingDisplay");
                panel.Loader = loader;
                string menuName = string.Format("MenuTab{0}", idTab);
                MenuPanel menu = new MenuPanel(){ID=menuName};
                menu.Menu.Add(new MenuItem() { Text = "test" });
                panel.AddTo(tabPanel);
                panel.Items.Add(menu);
                tabPanel.SetActiveTab(idTab);
                //response.Script = menu.ToScript(RenderMode.AddTo, menuName);
                response.Script += panel.ToScript(RenderMode.AddTo, idTab);
                
                
                return response;
            }
    my call

    Ext.net.DirectMethod.request({
            url: AppPath + "DashboardConfig/AddDashTab",
            contentType: 'application/json; charset=utf-8',
            type: 'POST',
            params: {
                url: urlFrame,
                idTab: idTab,
                title: type
            },
            success : function (result) {
                tabPanel.setActiveTab(idTab);
            }
        });
    Do you know how to show the tabMenu ?

    Regards
    Last edited by Daniil; Jun 10, 2014 at 3:00 PM. Reason: [CLOSED]
  2. #2
  3. #3
    Hi Dannil,

    sorry for my response late.

    I test this exemple with my direct call in js and I don't see my tab.

    I must call my direct method in js, I have some treatment before.

    Regards
  4. #4
    Please provide a test case to reproduce.
  5. #5
    Hi Daniil

    this is my sample to reproduce my problem

    Controleur

    public ActionResult Test()
            {
                return View();
    
            }
    
            public AjaxResult AddTab(string idTab, string url)
            {
                AjaxResult response = new Ext.Net.MVC.AjaxResult();
                var tabPanel = this.GetCmp<TabPanel>("tetst");
                Panel panel = new Panel { ID = idTab, Title = "test", Closable = true, Border = false, Layout = LayoutType.Fit.ToString() };
                ComponentLoader loader = new ComponentLoader { Url = url, Mode = LoadMode.Frame };
                loader.LoadMask.ShowMask = true;
                loader.LoadMask.Msg = "PreparingDisplay";
                panel.Loader = loader;
                string menuName = string.Format("MenuTab{0}", idTab);
                Menu menu = new Menu() { ID = menuName };
                MenuItem menuRefresh = new MenuItem() { Text = "Refresh" };
                menu.Add(menuRefresh);
                panel.TabMenu.Add(menu);
                panel.AddTo(tabPanel);
                //tabPanel.Add(panel);
    
                //panel.Render();
    
                tabPanel.SetActiveTab(idTab);
                response.Script = menu.ToScript(RenderMode.AddTo, menuName);
                response.Script += panel.ToScript(RenderMode.AddTo, idTab);
    
    
                return response;
            }
    View

    @using Ext.Net;
    @using Ext.Net.MVC;
    
    @Html.X().ResourceManager(ViewBag.ManagerConfig as MvcResourceManagerConfig).ShowWarningOnAjaxFailure(false)
    
    <script type="text/javascript">
        var testAddTab = function() {
            var id = 'test';
            var urlFrame = 'http://www.ext.net';
            Ext.net.DirectMethod.request({
                url: "AddTab",
                contentType: 'application/json; charset=utf-8',
                type: 'POST',
                params: {
                    url: urlFrame,
                    idTab: id
                }
            });
        };
    </script>
    @(
        Html.X().Viewport()
        .Layout(LayoutType.Fit)
        .Items
        (
            Html.X().TabPanel()
            .ID("tetst")
            .Buttons
            (
                Html.X().Button()
                .Text("test")
                .Listeners(p => p.Click.Fn = "testAddTab")
            )
        )
    )
  6. #6
    Please re-read the item #2 in the post that I mentioned.
    Quote Originally Posted by Daniil View Post
  7. #7
    Thank, i forgot this point
    TabMenu control is plugin (it is not menu) therefore instance of TabMenu must be added to Plugins section of TabPanel during initial page load (it will be added automatically if there are initial tabs with TabMenu)

Similar Threads

  1. [CLOSED] MVC TabMenu not showing
    By leonardm in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 21, 2013, 4:56 PM
  2. [CLOSED] MVC Razor and TabMenu
    By leonardm in forum 2.x Legacy Premium Help
    Replies: 7
    Last Post: Jul 22, 2013, 8:22 PM
  3. TabMenu in TabStrip not show
    By mercator in forum 1.x Help
    Replies: 0
    Last Post: Jun 25, 2012, 10:51 AM
  4. [CLOSED] TabMenu not added in Panel.
    By stoque in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Aug 30, 2011, 5:30 PM
  5. [CLOSED] Tabmenu in formpanel
    By Edward in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Sep 15, 2010, 1:40 PM

Tags for this Thread

Posting Permissions