View Full Version : VBox MVC Show Grey Rectangle on GridPanel

Dec 16, 2016, 1:24 PM
Hello, i'm starting a MVC project with Ext.Net. In my view, i have a gridpanel inside a vbox layout as follow

@model ExtNetMvcApplication.Models.Plant
var X = Html.X();
<title>Ext.NET MVC Sample</title>
<script type="text/javascript">
var showData = function (grid) {
grid.getStore().getProxy().setExtraParam('test', App.hiddenId.getValue());
//Ext.getCmp('hiddenId').setValue(new Date().getMinutes().toString());
.Title("My Query")
.LayoutConfig(new VBoxLayoutConfig { Align = VBoxAlign.Stretch })
X.Hidden().ID("hiddenId").Value("some value")

.Listeners(ls =>
ls.Click.Handler = "showData(App.GridPanel1)";

.Title("My Grid")
.ColumnModel(Html.X().Column().DataIndex(Model, m => m.Common).Text("Common Name"),
Html.X().Column().DataIndex(Model, m => m.Botanical).Text("Botanical").Width(230),
Html.X().Column().DataIndex(Model, m => m.Light).Text("Light").Width(130)
Html.X().RowSelectionModel().Mode(SelectionMode.Si ngle).DirectEvents(de =>
de.SelectionChange.Url = Url.Action("SetTimeStamp");
de.SelectionChange.Confirmation.Title = "Title";

Html.X().TextField().ID("TextField3").FieldLabel("Company Name").AllowBlank(false)

.Title("Close Me")
.Html("Closeable Tab")

And the controller is

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Ext.Net;
using Ext.Net.MVC;

namespace ExtNetMvcApplication.Controllers
public class ViewportLayoutController : Controller
// GET: /ViewportLayout/

public ActionResult Index()
return View();

public ActionResult SetTimeStamp()
var txtField = this.GetCmp<TextField>("TextField3");
txtField.Text = DateTime.Now.ToLongTimeString();

return this.Direct();

public ActionResult Read(StoreRequestParameters parameters, string test)
return this.Store(Models.Plant.PlantsPaging(parameters));

and my model exactly the same as the example.

The layout is looking good until user click test button. It show a grey rectangle on top of gridpanel. Pls let me know what wrong with my vbox layout. thank you. 2479624797

Dec 17, 2016, 1:17 AM
Hello @browndong, and welcome to Ext.NET forums!..

Sometimes dealing with layouts will require a lot of attention not to forget one or another specific trait of the layout setting.

In your test case, you needed to give either a fixed width or a flex value to the panel in the west region. According to the documentation on border layout (http://docs.sencha.com/extjs/6.0.2/classic/Ext.layout.container.Border.html) (see the notes in the summary of the feature), at least this was necessary to ensure the page would smoothly work. East, south and north will also require these settings. Omitting them may result in a working page but -- exactly as you witnessed -- layout refreshes may break, and that's a reasonably difficult aspect to tackle with.

Here are some relevant discussions on the subject:
- Post #9 in "Layout run failed" appears when displaying large no of dynamic MenuPanels inside Portals inside GroupTabPanel (http://forums.ext.net/showthread.php?25289&p=111619&viewfull=1#post111619). I believe reading from the first post down to this 9th post is enough to understand the problems around it and debugging alternatives.
- Border layout without region & CommandCOlumn (http://forums.ext.net/showthread.php?58181). Points to the relevance of considering the notes in the docs of the border layout.

As for the test case you provided, it was as hard to solve the issue as adding the .Flex(1) argument to line 23 of your view code. Properly indenting the razor syntax algorithm helps a lot identifying blocks and where the width/height or flex setting is missing.

We appreciate providing the runnable test case, but indenting the code and pointing the exact example you based your test case from (so we could pull the class directly from it without having to search over) would greatly help! :)

Anyway, hope the explanation above is clear and helps you make your page work smoothly!

Dec 19, 2016, 8:44 PM
thank you for the long explanation fabrizio. It solved my problem with the proper width of the gridpanel