Sep 15, 2015, 6:55 AM
[CLOSED] Issue with RowExpander opener
Hi
It's a very minor point but the +/- button to open the RowExpander in this application is only partially visible which makes it difficult to use. I'm using RowExpanders in several projects but I've never seen this happen before.
It's a very minor point but the +/- button to open the RowExpander in this application is only partially visible which makes it difficult to use. I'm using RowExpanders in several projects but I've never seen this happen before.
<!DOCTYPE html>
<html>
<head>
<title></title>
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
@section scripts
{
<script>
var edit = function (editor, e) {
if (!(e.value === e.originalValue || (Ext.isDate(e.value) && Ext.Date.isEqual(e.value, e.originalValue)))) {
if (e.field == "Name") {
innerGrid = e.grid.getRowExpander().getComponent(e.record);
if (innerGrid) { // It means that the edited row is expanded.
innerGrid.getStore().reload({
params: {
name: e.value
}
});
}
}
}
};
</script>
}
</head>
<body>
@section mainBody
{
@(Html.X().GridPanel().Width(352)
.Title("Users").ID("GridPanel").Border(true)
.Store(Html.X().Store()
.ID("Store")
.Model(Html.X().Model().IDProperty("ID")
.Fields(
new ModelField("ID", ModelFieldType.Int),
new ModelField("Name"),
new ModelField("Test")
)
)
.Proxy(Html.X().AjaxProxy().Url(Url.Action("Read")).Reader(Html.X().JsonReader().RootProperty("data"))))
.ColumnModel(
Html.X().Column().Text("User").DataIndex("Name").Width(100).Editor(Html.X().TextField()),
Html.X().Column().Text("Test").DataIndex("Test").Flex(50)
)
.SelectionModel(Html.X().RowSelectionModel().ID("rowSelectionModel").Mode(SelectionMode.Single))
.Plugins(
Html.X().CellEditing().ClicksToEdit(1).Listeners(ls => ls.Edit.Fn = "edit"),
Html.X().RowExpander().SingleExpand(true).ID("RowExpand")
.Component(
Html.X().GridPanel().Border(true).Height(250).ID("AccessgridPanel")
.Store(Html.X().Store().ID("RowExpanderStore")
.Model(Html.X().Model()
.Fields(
new ModelField("Option"),
new ModelField("IsReadOnly", ModelFieldType.Boolean)
)
)
.Proxy(Html.X().AjaxProxy().Url(Url.Action("RowExpander")).Reader(Html.X().JsonReader().RootProperty("data")))
.AutoLoadParams(new { name = JRawValue.From("this.record.data.Name") }))
.ColumnModel(
Html.X().Column().Text("Option").DataIndex("Option").Flex(1),
Html.X().CheckColumn().Text("Read Only?").DataIndex("IsReadOnly").Width(100).Editable(true)
)
)
)
)
}
</body>
</html>
using Ext.Net;
using Ext.Net.MVC;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
namespace ExtSandpit.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult Read()
{
List<User> lstUsers = new List<User>();
lstUsers.Add(new User(1000,"Jeff"));
lstUsers.Add(new User(1001,"James"));
return this.Store(lstUsers);
}
public ActionResult RowExpander(string name)
{
List<AccessOptionDetail> lstAccessOptionDetail = new List<AccessOptionDetail>();
if (name == "Jeff")
{
lstAccessOptionDetail.Add(new AccessOptionDetail(1, "Goods In", true));
}
else if (name == "James")
{
lstAccessOptionDetail.Add(new AccessOptionDetail(2, "Production", false));
}
else if (name == "Chris")
{
lstAccessOptionDetail.Add(new AccessOptionDetail(1, "Goods In", true));
lstAccessOptionDetail.Add(new AccessOptionDetail(2, "Production", false));
}
return this.Store(lstAccessOptionDetail);
}
}
public class User
{
public User()
{
}
public User(int id, string name)
{
ID = id;
Name = name;
}
public int ID { get; set; }
public string Name { get; set; }
public string Test { get; set; }
}
public class AccessOptionDetail
{
public AccessOptionDetail()
{
}
public AccessOptionDetail(int id, string option, bool isreadonly)
{
ID = id;
Option = option;
IsReadOnly = isreadonly;
}
public int ID { get; set; }
public string Option { get; set; }
public bool? IsReadOnly { get; set; }
}
}
Last edited by Daniil; Sep 22, 2015 at 11:15 AM.
Reason: [CLOSED]