Store causes Partial View to not render properly [MVC - Razor]

  1. #1

    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
    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_Controller
    public 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?
  2. #2
    I have also found trying to add a TaskManager to a Partial view also causes JS errors - but only when loading through Script mode in PartialViews

    Is there any answer to this?
  3. #3
    Move Store to Panel Bin collection (for GridPanel just use inner Store property)

Similar Threads

  1. [CLOSED] Using Razor Partial View on Non-Razor View
    By Patrick_G in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Nov 26, 2013, 4:09 AM
  2. Replies: 4
    Last Post: Apr 09, 2012, 2:10 PM
  3. [CLOSED] Razor syntax for adding a partial view to a Panel
    By machinableed in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 23, 2012, 9:55 AM
  4. [CLOSED] Render Partial View on request failure
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Apr 01, 2011, 1:51 PM
  5. Can't add record to store from partial view
    By craig2005 in forum 1.x Help
    Replies: 14
    Last Post: Jan 05, 2011, 11:59 PM

Posting Permissions