[CLOSED] load grid inside RowExpander Plugin

Page 1 of 2 12 LastLast
  1. #1

    [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
    @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...
    please let me know what change in code make this working.
    Last edited by Daniil; Dec 21, 2014 at 1:25 PM. Reason: [CLOSED]
  2. #2
    Hi @matrixwebtech,

    Please don't use .getComponent() with the .SingleExpand(true) setting.

    In your case I would try this code:
    l.Expand.Handler = "this.component.getStore().reload({ params:  { company: record.data.company }});";
  3. #3
    Thanks for reply daniil,

    I change
     .Listeners(l => { l.Expand.Handler = "this.component.getStore().reload({ params:  { company: record.data.company }});"; })
    and bellow is GetData() Method


      public StoreResult GetData(string company, string 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);
             
    
            }
    But an error occurred.

    Server Error in '/' Application.
    The ResourceManager Control is missing from this Page.

    Please add the following ResourceManager tag inside the <body> or <form runat="server"> of this Page.
    and what if i use

                    .SingleExpand(false)
    Last edited by matrixwebtech; Nov 05, 2014 at 11:56 AM.
  4. #4
    At which moment does the error occur?

    Also I am not sure what you mean here:
    Store store = X.GetCmp<Store>("store1");
    store.LoadData(Questions);
    
    return this.Store(store);
    I think this entire piece of code should be replaced with
    return this.Store(Questions);
  5. #5
    Thaks daniil,
    Its working.can you please let me know how to write .Listeners for

    .SingleExpand(false)
    in this post ,so that I can post all solution here for others ,with both situation

    .SingleExpand(false)
    and
    .SingleExpand(true)
    Last edited by matrixwebtech; Nov 05, 2014 at 11:55 AM.
  6. #6
    With .SingleExpand("false"), probably, the .getComponent() function is a way to go.
  7. #7
    I set

    .SingleExpand(false)
    and

     .Listeners(l => { l.Expand.Handler = "this.getComponent(record).down('gridpanel').getStore().reload({ params: { company: record.data.company }});"; })
    but unfortunately not working.

    Error in firebug is

    TypeError: this.getComponent(...).down(...) is null


    ...(item,record,body,row,rowIndex){this.getCompone nt(record).down('gridpanel').getS...
    Last edited by matrixwebtech; Nov 05, 2014 at 11:55 AM.
  8. #8
    I don't see that your inner GridPanel contains a GridPanel.
  9. #9
    Please check ,I code bellow

    @model System.Collections.IEnumerable
    @Html.X().ResourceManager()
    
    @(
     Html.X().GridPanel()
                .Title("Expander Rows with server side data")
               .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(false)
                   .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)
                              
                                )
    
                                )
                                )
                                .ColumnModel(
    
                                Html.X().Column().DataIndex("company").Text("Common Name 1").Flex(1).MenuDisabled(true)
                             
                                )
    
                        )
    
                )
                 .SelectionModel(
                Html.X().CheckboxSelectionModel()
                    .Mode(SelectionMode.Multi)
                  .InjectCheckbox("1")
    
                )
        )

    namespace e.Controllers
    {
        public class RowExpanderController : Controller
        {
            //
            // GET: /RowExpander/
    
            public ActionResult Index()
            {
                return View(Companies.GetCompanies());
            }
    
            public StoreResult GetData(string company, string index)
            {
                
    
                var Questions = new List<jr>
            {
                new jr {company = "s1"},
                new jr {company = "s2"},
                new jr {company = "s3"},
                new jr {company = "s4"},
            };
    
                
                return this.Store(Questions);
             
    
            }
    
    
        }
    
        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; }
        }
    }
    Last edited by matrixwebtech; Nov 05, 2014 at 11:55 AM.
  10. #10
    I don't see that your inner GridPanel contains a GridPanel.
    I mean why do you do .down('gridpanel')? The RowExpander's Component is a GridPanel itself.
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] grid with rowexpander and celledit plugin
    By elke.schreiber in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Dec 11, 2013, 12:21 PM
  2. [CLOSED] performing editing the grid inside row expander plugin
    By pawangyanwali in forum 2.x Legacy Premium Help
    Replies: 8
    Last Post: May 13, 2013, 5:40 AM
  3. [CLOSED] GridPanel RowExpander Plugin
    By softmachine2011 in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 21, 2012, 6:32 AM
  4. [CLOSED] RowExpander Plugin for Grid
    By craig2005 in forum 1.x Legacy Premium Help
    Replies: 16
    Last Post: Jul 14, 2011, 2:48 PM
  5. [CLOSED] Locking Grid with RowExpander plugin
    By leon_tang in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 23, 2011, 2:37 PM

Posting Permissions