Aug 22, 2014, 7:07 AM
[CLOSED] load grid inside RowExpander Plugin
hi
I have grid with row expander plugins and inside this plugin I take another grid inside component.I need, on click on rowexpander the inner grid load with data.
With reference of http://forums.ext.net/showthread.php...de-rowexpander
I tried bellow
View
Contoller and Sampledata
but in fire bug I found and error
please let me know what change in code make this working.
I have grid with row expander plugins and inside this plugin I take another grid inside component.I need, on click on rowexpander the inner grid load with data.
With reference of http://forums.ext.net/showthread.php...de-rowexpander
I tried bellow
View
@model System.Collections.IEnumerable
@Html.X().ResourceManager()
@(
Html.X().GridPanel()
.Title("Expander Rows with server side data")
.Icon(Icon.Table)
.Width(600)
.Height(300)
.Store(Html.X().Store()
.DataSource(Model)
.Model(Html.X().Model()
.Fields(
Html.X().ModelField().Name("company")
)
)
)
.ColumnModel(
Html.X().Column().DataIndex("company").Text("Company").Flex(1)
)
.Plugins(
Html.X().RowExpander()
.ID("RowExpander1")
.SingleExpand(true)
.Listeners(l => { l.Expand.Handler = "this.getComponent(record).down('gridpanel').getStore().reload({ params: { company: record.data.company }});"; })
.Component
(
Html.X().GridPanel()
.Store(
Html.X().Store()
.ID("Store1")
.AutoLoad(false)
.Proxy(Html.X().AjaxProxy()
.Url(Url.Action("GetData"))
.Reader(Html.X().JsonReader().Root("data"))
)
.Model
(
Html.X().Model()
.Fields
(
Html.X().ModelField().Name("company").Type(ModelFieldType.String),
Html.X().ModelField().Name("index").Type(ModelFieldType.String),
Html.X().ModelField().Name("time").Type(ModelFieldType.String)
)
)
)
.ColumnModel(
Html.X().Column().DataIndex("company").Text("Common Name 1").Flex(1),
Html.X().Column().DataIndex("index").Text("Common Name 2").Flex(1),
Html.X().Column().DataIndex("time").Text("Common Name 3").Flex(1)
)
)
)
.SelectionModel(
Html.X().CheckboxSelectionModel()
.Mode(SelectionMode.Multi)
.InjectCheckbox("1")
)
)
Contoller and Sampledata
public ActionResult Index()
{
return View(Companies.GetCompanies());
}
public StoreResult GetData(string company, int index)
{
var Questions = new List<jr>
{
new jr {company = "s1", index = "Q1,Q2",time=DateTime.Now.ToLongTimeString()},
new jr {company = "s2", index = "Q1,Q2,Q3",time=DateTime.Now.ToLongTimeString()},
new jr {company = "s3", index = "Q1,Q2,Q4",time=DateTime.Now.ToLongTimeString()},
new jr {company = "s4", index = "Q1,Q2,Q5",time=DateTime.Now.ToLongTimeString()},
};
Store store = X.GetCmp<Store>("store1");
store.LoadData(Questions);
return this.Store(store);
}
}
public class Companies
{
public static IEnumerable GetCompanies()
{
DateTime now = DateTime.Now;
return new object[]
{
new object[] { "3m Co" },
new object[] { "IBM"},
};
}
}
public class jr
{
public string company { get; set; }
public string index { get; set; }
public string time { get; set; }
}
but in fire bug I found and error
TypeError: App.RowExpander1.getComponent(...) is null
...(item,record,body,row,rowIndex){App.RowExpander 1.getComponent(record).down('grid...
...(item,record,body,row,rowIndex){App.RowExpander 1.getComponent(record).down('grid...
Last edited by Daniil; Dec 21, 2014 at 1:25 PM.
Reason: [CLOSED]