Sep 11, 2015, 2:13 PM
[CLOSED] Refresh open RowExpander GridPanel without closing and opening again
Hi
I have a RowExpander with a GridPanel and I want to be able to open the RowExpander, make a change to the parent record and refresh the RowExpander without having to open and close the RowExpander. I've tried many things but I can't get hold of the RowExpander GridPanel's store iin order to reload it.
In this example:
I'm sure there's an easy way to do it but...
Thanks
Jeff
I have a RowExpander with a GridPanel and I want to be able to open the RowExpander, make a change to the parent record and refresh the RowExpander without having to open and close the RowExpander. I've tried many things but I can't get hold of the RowExpander GridPanel's store iin order to reload it.
In this example:
<!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") {
}
}
};
</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; }
}
}
I want to be able to:- open the RowExpander for the 'Jeff' record
- change 'Jeff' to 'Chris'
- see the GridPanel contents change
I'm sure there's an easy way to do it but...
Thanks
Jeff
Last edited by Daniil; Sep 15, 2015 at 7:19 AM.
Reason: [CLOSED]