Aug 15, 2014, 9:28 AM
Vertical scrollbar for gridpanel in panel MVC
Hello
Please take a look at this sample:
Model:
Please take a look at this sample:
Model:
public class MyModel
{
public int ID { get; set; }
public string StringValue { get; set; }
public static List<MyModel>GetAll()
{
List<MyModel> myModels = new List<MyModel>();
for (int i = 0; i < 100; i++)
myModels.Add(new MyModel() { ID = i, StringValue = String.Format("String{0}", i) });
return myModels;
}
}
View:@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_BaseLayout.cshtml";
var X = Html.X();
}
@section example
{
<script>
var onSuccess = function (grid, data) {
grid.getStore().loadData(data);
};
</script>
@(
X.Panel().Items
(
X.FormPanel().Title("Search Form").Height(300).Layout(LayoutType.Form).AutoScroll(true).Items
(
fields =>
{
for(int i=0;i<20;i++)
{
fields.Add(X.TextField().FieldLabel(String.Format("Search field {0}", i)).Width(300));
}
}
)
.Buttons
(
X.Button().Text("Search").Icon(Icon.Find).DirectEvents(de => {
de.Click.Url = Url.Action("DoSearch");
de.Click.Success = "onSuccess(App.Grid, result.data);";
de.Click.EventMask.ShowMask = true;
})
)
,
X.GridPanel().ID("Grid").Title("Grid").AutoScroll(true).Store(X.Store().Fields
(
new ModelField("ID"),
new ModelField("StringValue")
))
.ColumnModel
(
X.Column().Text("ID").DataIndex("ID"),
X.Column().Text("String Value").DataIndex("StringValue")
)
)
)
}
Controler:public class HomeController : Controller
{
// GET: Home
public ActionResult Index()
{
return View();
}
public ActionResult DoSearch()
{
return this.Store(MyModel.GetAll());
}
}
Problem is that when GridPanel is filled with data (after I click search button) it does not show vertical scrollbar. FormPanel shows it correctly. I guess the problem is moment of rendering. I tried with different layout types of panel but nothing seem to help. Any suggestions?