[CLOSED] [MVC] ItemClickListeners not fire after show an hiddenPanel with accordion

  1. #1

    [CLOSED] [MVC] ItemClickListeners not fire after show an hiddenPanel with accordion

    Hi guys,

    I have an accordion panel with 2 panels.
    My first contains 2 gridPanel associated.
    The first gridPanel has an itemClickListeners that bind the second gridPanel
    My Second is a hide panel

    When i click on item into second gridPanel, i show my hide panel.
    After this, i can't fire my itemClickListeners in first panel.

    TestView
    @using Ext.Net;
    @using Ext.Net.MVC;
    @model List<Categories>
    
    @Html.X().ResourceManager(ViewBag.ManagerConfig as MvcResourceManagerConfig)
    
    <script type="text/javascript">
        var testShowPanel = function () {
            Ext.getCmp('PanelSite').show();
        }
    </script>
    
    @(
     Html.X().Viewport()
        .Layout(LayoutType.Fit)
        .Items(
            Html.X().Panel()
            .ID("AccordionPanel")
            .Layout(LayoutType.Accordion)
            .ButtonAlign(Alignment.Center)
            .Items(
                    Html.X().Panel()
                    .ID("PanelSelection")
                    .Layout(LayoutType.HBox)
                .Title("Selection"))
                .Items
                (
                    Html.X().GridPanel()
                    .Flex(1)
                    .HideHeaders(true)
                    .Listeners(p =>
                    {
                        p.ItemClick.Handler = "#{GrilleOutput}.bindStore(record.colonnesTest())";
                    })
                    .Store(Html.X().Store()
                        .Model(Html.X().Model()
                            .Name("ModelDashBoardCategory")
                            .IDProperty("Id")
                            .Fields(
                                new ModelField("Id", ModelFieldType.Int),
                                new ModelField("Group", ModelFieldType.String)
                            )
                            .Associations(p =>
                            {
                                p.Add(new HasManyAssociation()
                                {
                                    Model = "testModel",
                                    Name = "colonnesTest",
                                    AssociationKey = "ProcedureParameters"
                                });
                            })
                        )
                        .Data(Model)
                        .AutoDataBind(true)
                    )
                    .ColumnModel(
                        Html.X().Column().Flex(1).DataIndex("Group")
                    ),
                    Html.X().GridPanel()
                    .Flex(1)
                    .ID("GrilleOutput")
                    .HideHeaders(true)
                    .Store(Html.X().Store()
                        .Model(Html.X().Model()
                            .Name("testModel")
                            .IDProperty("Id")
                            .Fields(
                                new ModelField("Id", ModelFieldType.Int),
                                new ModelField("Name", ModelFieldType.String)
                            )
                        )
                    )
                    .ColumnModel(
                        Html.X().Column().Flex(1).DataIndex("Name")
                    )
                    .Listeners(p =>
                        {
                            p.ItemClick.Fn = "testShowPanel";
                        })
                ),
                Html.X().Panel()
                .ID("PanelSite")
                .Title("SiteTitle"))
                .Layout(LayoutType.Fit)
                .Hidden(true)
            )
            .Buttons(
                Html.X().Button()
                .ID("ButStartConfig")
                .Text("Lancer")
                .Hidden(true)
            )
        )
    )
    Categories.cs
        public class Categories
        {
            private List<Parameters> _parameters = new List<Parameters>();
    
            public int Id { get; set; }
    
            public string Group { get; set; }
    
            public List<Parameters> Parameters { get { return _parameters ; } set { _parameters = value; } }
        }
    Parameters.cs

    public class Parameters
        {
            public int Id { get; set; }
            public string Name { get; set; }
        }
    Regards
    Last edited by Daniil; Sep 06, 2013 at 11:21 AM. Reason: [CLOSED]
  2. #2
    Hi @Tactem,

    I see there is kind of mayhem with brackets.

    For example, this
    .Hidden(true)
    at very bottom is applied to the Viewport. So, it gets hidden initially.

    Probably, the GridPanels are supposed to be the items of the PanelSelection, but they are actually the items of the AccordionPanel due to the second closing bracket here:
    .Title("Selection"))
    It confuses. Currently, running your test case I see nothing because a Viewport is hidden.
  3. #3
    Hi Daniil

    .Title("Selection"))
    is an error to past code the original code was this
    .Title(Html.GetResource("Selector", "Selection"))
    it the same for this
    .Title("SiteTitle"))
    sorry for this

    Correct code

    @(
     Html.X().Viewport()
        .Layout(LayoutType.Fit)
        .Items(
            Html.X().Panel()
            .ID("AccordionPanel")
            .Layout(LayoutType.Accordion)
            .ButtonAlign(Alignment.Center)
            .Items(
                    Html.X().Panel()
                    .ID("PanelSelection")
                    .Layout(LayoutType.HBox)
                .Title("Selection")
                .Items
                (
                    Html.X().GridPanel()
                    .Flex(1)
                    .HideHeaders(true)
                    .Listeners(p =>
                    {
                        p.ItemClick.Handler = "#{GrilleOutput}.bindStore(record.colonnesTest())";
                    })
                    .Store(Html.X().Store()
                        .Model(Html.X().Model()
                            .Name("ModelDashBoardCategory")
                            .IDProperty("Id")
                            .Fields(
                                new ModelField("Id", ModelFieldType.Int),
                                new ModelField("Group", ModelFieldType.String)
                            )
                            .Associations(p =>
                            {
                                p.Add(new HasManyAssociation()
                                {
                                    Model = "testModel",
                                    Name = "colonnesTest",
                                    AssociationKey = "ProcedureParameters"
                                });
                            })
                        )
                        .Data(Model)
                        .AutoDataBind(true)
                    )
                    .ColumnModel(
                        Html.X().Column().Flex(1).DataIndex("Group")
                    ),
                    Html.X().GridPanel()
                    .Flex(1)
                    .ID("GrilleOutput")
                    .HideHeaders(true)
                    .Store(Html.X().Store()
                        .Model(Html.X().Model()
                            .Name("testModel")
                            .IDProperty("Id")
                            .Fields(
                                new ModelField("Id", ModelFieldType.Int),
                                new ModelField("Name", ModelFieldType.String)
                            )
                        )
                    )
                    .ColumnModel(
                        Html.X().Column().Flex(1).DataIndex("Name")
                    )
                    .Listeners(p =>
                        {
                            p.ItemClick.Fn = "testShowPanel";
                        })
                ),
                Html.X().Panel()
                .ID("PanelSite")
                .Title("SiteTitle")
                .Layout(LayoutType.Fit)
                .Hidden(true)
            )
            .Buttons(
                Html.X().Button()
                .ID("ButStartConfig")
                .Text("Lancer")
                .Hidden(true)
            )
        )
    )
  4. #4
    Thank you, now I see the stuff.

    Though, may I ask the exact steps to reproduce the problem?
  5. #5
    Steps :
    - i select an item on left gridPanel
    - the leftGridPanel bind RightGridPanel
    - i select an item on the right gridPanel
    - this select call testShowPanel function
    - PanelSite was show but not expand
    - i select another item on left gridPanel
    - the leftGridPanel does'nt bind RightGridPanel
  6. #6
    Quote Originally Posted by Tactem View Post
    Steps :
    - i select an item on left gridPanel
    - the leftGridPanel bind RightGridPanel
    Nothing happens here for me. I think because of mismatching of these things:
    AssociationKey = "ProcedureParameters"
    and
    public List<Parameters> Parameters { get { return _parameters ; } set { _parameters = value; } }
    I think the AssociationKey should match the property's name.
  7. #7
    AssociationKey = "Parameters"
    sorry it's another copy error

    it would not work the first time if
  8. #8
    Thank you. Now I reproduced.

    This is related to this bug:
    http://forums.ext.net/showthread.php?26378

    Also showing an item doesn't expand it. At least, now. You should do that manually by calling the expand method.

    Please use this script.
    Ext.layout.container.Accordion.override({
        onComponentShow: Ext.emptyFn
    });
    
    var testShowPanel = function () {
        var p = Ext.getCmp('PanelSite');
    
        p.show();
        p.expand();
    };
  9. #9
    il's work with just this part

    Ext.layout.container.Accordion.override({
        onComponentShow: Ext.emptyFn
    });
    Thank you daniil

    it's ok for this subject also http://forums.ext.net/showthread.php...955#post116955

    regards

Similar Threads

  1. [CLOSED] Accordion
    By Akpenob in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 26, 2013, 12:18 PM
  2. Replies: 11
    Last Post: Apr 04, 2013, 4:49 AM
  3. [CLOSED] Show no expandable panel in accordion layout panel
    By Tactem in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Nov 13, 2012, 4:07 PM
  4. Replies: 1
    Last Post: Jan 27, 2012, 11:32 AM
  5. Replies: 5
    Last Post: Nov 11, 2010, 7:33 PM

Tags for this Thread

Posting Permissions