PDA

View Full Version : [CLOSED] [MVC] ItemClickListeners not fire after show an hiddenPanel with accordion



Tactem
Sep 05, 2013, 8:57 AM
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

Daniil
Sep 05, 2013, 9:40 AM
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.

Tactem
Sep 05, 2013, 9:52 AM
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)
)
)
)

Daniil
Sep 05, 2013, 10:01 AM
Thank you, now I see the stuff.

Though, may I ask the exact steps to reproduce the problem?

Tactem
Sep 05, 2013, 12:33 PM
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

Daniil
Sep 05, 2013, 2:26 PM
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.

Tactem
Sep 05, 2013, 3:10 PM
AssociationKey = "Parameters" sorry it's another copy error

it would not work the first time if

Daniil
Sep 06, 2013, 4:28 AM
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();
};

Tactem
Sep 06, 2013, 9:07 AM
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?26378-OPEN-342-MVC-Accordion-Render&p=116955#post116955

regards