PDA

View Full Version : [CLOSED] GridPanel ComponentColumn in partial view giving 'me undefined error '



PriceRightHTML5team
Sep 11, 2014, 4:32 PM
HI,

Mine is an ASP.net MVC razor view engine application.

I have a partial view in which i have a grid panel.

The grid panel has a component column.

Following are the snippets of model, controller and views to reproduce the issue.



public class PackPayerDTO
{
public string Channel { get; set; }
public decimal? MaxFeesPercent { get; set; }
public decimal? MaxDiscountPercent { get; set; }

public List<PackPayerDTO> PackPayers { get; set; }

}






public class PackPayerController
{

public ActionResult IndexDummy()
{
return View("IndexDummy");
}

public ActionResult test(string containerId)
{
PackPayerDTO packPayer = new PackPayerDTO();
packPayer.PackPayers = new List<PackPayerDTO>();

packPayer.PackPayers.Add(new PackPayerDTO { Channel = "Channel 1", MaxFeesPercent = 20, MaxDiscountPercent = 90 });
packPayer.PackPayers.Add(new PackPayerDTO { Channel = "Channel 2", MaxFeesPercent = 20, MaxDiscountPercent = 90 });
packPayer.PackPayers.Add(new PackPayerDTO { Channel = "Channel 3", MaxFeesPercent = 20, MaxDiscountPercent = 90 });
packPayer.PackPayers.Add(new PackPayerDTO { Channel = "Channel 4", MaxFeesPercent = 20, MaxDiscountPercent = 90 });

return new Ext.Net.MVC.PartialViewResult
{
ViewName = "_test",
ContainerId = containerId,
ClearContainer = true,
Model = packPayer,
RenderMode = RenderMode.AddTo

};
}


public ActionResult test1(string containerId)
{
return new Ext.Net.MVC.PartialViewResult
{
ViewName = "_test1",
ContainerId = containerId,
ClearContainer = true,
RenderMode = RenderMode.AddTo

};
}


}



Index Dummy view




@{
ViewBag.Title = "Admin Home";

var X = Html.X();
}

<script> var Navigation = function (action, controller) {

var url = '@Url.Action("action", "controller")';
url = url.replace("action", action);
url = url.replace("controller", controller);
Ext.net.Mask.show();
Ext.net.directRequest({
timeout: 7000000,
url: url,
extraParams: { ContainerId: "ChildContentContainer" },
success: function () { Ext.net.Mask.hide(); $(".main-content").animate({ scrollTop: 0 }, "slow"); },
failure: function () { Ext.net.Mask.hide(); }
});
};</script>

@Html.X().ResourceManager().CleanResourceUrl(false )


@(Html.X().Container().ID("ContainerAdminHome").Cls("twelve columns")
.Items(
Html.X().Panel().ID("pnlAdminMenu").Title("MasterMenu")
.Cls("three columns")
.Collapsible(true).CollapseDirection(Direction.Lef t).Border(true).TitleCollapse(true)
.StyleSpec("padding:0px 5px 0px 0px !important; min-height:400px !important")
.BodyStyle("border:none !important").OverflowY(Overflow.Hidden)
.Region(Ext.Net.Region.West)
.Margins("5 0 5 0")
.Border(false)
.Items(panelitems =>
{
panelitems.Add(Html.X().MenuPanel().Collapsible(tr ue).TitleCollapse(true)
.CollapseDirection(Direction.Top)
.Collapsed(true)

.Height(100)
.Menu(menu =>
{
menu.Items.Add(Html.X().MenuItem().Text("Test Data").IconCls("v-menu-bulletstyle").Handler("Navigation('test','PackPayer');"));
menu.Items.Add(Html.X().MenuItem().Text("Test 1").IconCls("v-menu-bulletstyle").Handler("Navigation('test1','PackPayer');"));
}));
})
,
Html.X().Container().ID("ChildContentContainer")
.Cls("nine columns")
.StyleSpec("width:97% ")
//.DirectEvents(de =>
//{
// de.Render.Url = Url.Action("Index", "UserManage");
// de.Render.ExtraParams.Add(new { ContainerId = "ChildContentContainer" });
//})

)
)




Test Partial View



@model PackPayerDTO


@(Html.X().Panel().Title("US Contracting Feed Management").BodyPadding(5)
.Items(
Html.X().GridPanel()
.Border(true)
.SortableColumns(false)
.EnableColumnHide(false)
.Scroll(ScrollMode.Horizontal)
.Store(Html.X().Store().PageSize(50)
.SortOnFilter(false).SortOnLoad(false)
.Model(Html.X().Model()
.Fields(
new ModelField("Channel", ModelFieldType.String)
, new ModelField("AdjustmentType", ModelFieldType.String)
, new ModelField("Weight", ModelFieldType.String)
, new ModelField("MaxFeesPercent", ModelFieldType.String)
, new ModelField("MaxDiscountPercent", ModelFieldType.String)
)
).DataSource(Model.PackPayers)
)

.ColumnModel(
Html.X().Column().Text("Channel").DataIndex("Channel").Flex(2),
Html.X().ComponentColumn().Text("Channel Weight % *")
.DataIndex("Weight").Flex(1)
.Editor(true)
.Component(Html.X().NumberField()
.HideTrigger(true).KeyNavEnabled(false).MouseWheel Enabled(false).AllowExponential(false)
)
)

)
)



Test 1 partial view



@(Html.X().DisplayField().Text("This is another partial view"))


Issue :
Following are the steps to reproduce the issue
1. Expand menu
2. Click on Test Data link. This will load view having component column gird panel.
3. Click on Test 1 link

Observe. Getting below error

http://forums.ext.net/attachment.php?attachmentid=15051&stc=1

Daniil
Sep 11, 2014, 5:00 PM
Hi @PriceRightHTML5team,

Please clarify is that a duplicate of this thread?
http://forums.ext.net/showthread.php?43271

Looks very similar.