Jan 30, 2014, 7:20 PM
Store causes Partial View to not render properly [MVC - Razor]
Regardless of the amount of combinations I use, I can't get a free-floating store added into a partial view - these are handy when that view has a combo box editor in a grid that I want to run in edit mode, and the value should render out a display value instead of the id in the grid before editing.
Example (using the latest - 2.4):
View
Example (using the latest - 2.4):
View
X.Panel()
.ID("CenterPanel")
.Region(Region.Center)
.Border(false)
.BodyPadding(6)
.Loader(
X.ComponentLoader ( )
.Url ( Url.Action ( "Center_Partial" ) )
.Mode ( LoadMode.Script )
.LoadMask ( lm => lm.ShowMask = true )
)
Parital_View@model List<myNamespace.Models.Season>
@{
ViewBag.Title = "Center_Partial";
var X = Html.X();
}
@(
X.Store ( )
.ID ( "SeasonStore" )
.DataSource ( Model )
.Reader ( X.JsonReader ( ) )
.Model (
X.Model ( )
.IDProperty ( "Season_ID" )
.Fields (
new ModelField ( "Season_ID" , ModelFieldType.String ) ,
new ModelField ( "Season_Name" , ModelFieldType.String )
)
)
.Sorters(
X.DataSorter().Property("Season_ID").Direction(Ext.Net.SortDirection.ASC)
)
)
// below should be a grid panel with editors, but I 've just rendered this to make sure the Model was consistant and wasn't the problem
@(
X.Panel()
.Items( item =>
{
foreach ( var season in Model )
{
item.Add (
X.Button ( ).Text ( season.Season_Name )
);
}
}
)
)
PartialView_Controllerpublic Ext.Net.MVC.PartialViewResult Center_Partial ( )
{
myEntities db = new myEntities();
List<Season> oList = db.Seasons.ToList ( );
return new Ext.Net.MVC.PartialViewResult
{
RenderMode = Ext.Net.RenderMode.AddTo ,
ContainerId = "CenterPanel" ,
Model = oList ,
WrapByScriptTag = false // we load the view via Loader with Script mode therefore script tags is not required
};
}
Any suggestion as to why these are not rendering?