1. #1
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,272
    Vote Rating
    81
    ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough

      0  

    Default Ext.ux.RowExpander: more than one expand column

    Ext.ux.RowExpander: more than one expand column


    Hi.

    I have a very annoying problem with Ext.ux.RowExpander, let me explain:

    I have an grid panel which is meant to be instantiated multiple times with its own store.

    It works as expected but when I add the RowExpander plugin, each time I instantiate the panel grid I got another expand column: first istantiation = 1 expand column, second instantiation = 2 expand columns and so.

    I looked at the pluing code and found that plugin allways add the column without checking if already exists. I modified the code so headerId of the plugin´s config is looked in the columns array and if is there dont create the column.

    So far, this seems to work but each time I expand or collapse a record in 2d and further instances I get the following error:

    Uncaught TypeError: Cannot read property 'internalId' of undefined

    There is a plugin´s internal property called recordsExpanded which I dont understand what is for.

    Some help here please.

    Regards.
    UI: Sencha Architect 3.x / ExtJS 4 & 5
    Server side: JEE / EJB 3.x / CDI / JPA 2.x/ JAX-RS / JasperReports
    Application Server: Glassfish / WildFly
    Databases: Oracle / DB2 / MySQL / Firebird

    If you like my answer please vote!

  2. #2
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,272
    Vote Rating
    81
    ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough

      0  

    Default


    UPDATE:

    If I close the first instance expand stop working on any other grid, this is the stack trace:

    Uncaught TypeError: Cannot read property 'data' of null
    Ext.define.getRecordAbstractView.js:629
    Ext.define.toggleRowRowExpander.js:189
    (anonymous function)ext-debug.js:2115
    processEventRowExpander.js:232
    Ext.define.processEventTable.js:726
    fireext-debug.js:16320
    Ext.define.fireEventObservable.js:266
    Ext.override.fireEventEventBus.js:24
    Ext.define.processItemEventTable.js:653
    Ext.define.processUIEventView.js:446
    Ext.define.handleEventView.js:385
    anonymous:5
    wrapext-debug.js:16885

    It seems that I will pass my code from "Ext.define(...)" to instantiate the whole panel in code.

    Regards.
    UI: Sencha Architect 3.x / ExtJS 4 & 5
    Server side: JEE / EJB 3.x / CDI / JPA 2.x/ JAX-RS / JasperReports
    Application Server: Glassfish / WildFly
    Databases: Oracle / DB2 / MySQL / Firebird

    If you like my answer please vote!

  3. #3
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,272
    Vote Rating
    81
    ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough

      0  

    Default


    UPDATE:

    FWIW I finally do all the grid instatiation by code instead of Ext.define() / Ext.widget().

    Now it works well, features / plugins alters the definition so all instances uses the same values / objects.

    Now I want to show in the expanded row nested store but templates cant do that.

    ExtJS MVC works well for "singleton" controllers, views and stores but I just realized that I'm gradually going to old model because the "singleton" nature of MVC.

    Regards.
    UI: Sencha Architect 3.x / ExtJS 4 & 5
    Server side: JEE / EJB 3.x / CDI / JPA 2.x/ JAX-RS / JasperReports
    Application Server: Glassfish / WildFly
    Databases: Oracle / DB2 / MySQL / Firebird

    If you like my answer please vote!

  4. #4
    Sencha User
    Join Date
    Nov 2010
    Posts
    33
    Vote Rating
    0
    andy13c72back is on a distinguished road

      0  

    Default


    Great ssamayoa! I have the same problem with yours and I'm so mad of it. Would you mind post the detailed code here or send it to my email "andy13c72back@hotmail.com".

    Great thanks in advance!

  5. #5
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,272
    Vote Rating
    81
    ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough

      0  

    Default


    No much to say other than instead of Ext.define(...) I created a singleton class which does a Ext.create("Ext.grid.Panel", options) where options is stack var instead of "class" var:

    PHP Code:
        crearXPeriodo : function(periodo) {
            var 
    store Ext.create("pp.store.pago.Pagos", {
                
    sorters : [ "empleadoCodigo" ]
            });
            
    store.getProxy().extraParams = {
                
    periodoId periodo.get("id")
            };
            var 
    grid Ext.create("Ext.grid.Panel", {
                
    store store,
                
    loadMask true,
                
    columns : [ {
                    
    xtype "actioncolumn",
                    
    width 25,
                    
    align "center",
                    
    items : [ {
                        
    // TODO: No funciona iconCls...
                        // iconCls : "det",
                        
    icon "img/det16.png",
                        
    tooltip "Conceptos",
                        
    handler : function(gridrici) {
                            
    GridPagos.mostrarConceptos(gridgrid.getStore().getAt(ri));
                        }
                    } ]
                }, {
                    
    header "Código",
                    
    dataIndex "empleadoCodigo",
                    
    hideable false
    ...
                
    plugins : [ {
                    
    ptype "rowexpander",
                    
    rowBodyTpl this.detalleTpl,
                    
    expandOnDblClick false
                
    } ],
                
    listeners : {
                    
    beforerender : function(me) {
                        
    me.store.load();
                    }
                }
            });
            return 
    grid;
        }, 
    Regards.
    Last edited by ssamayoa; 28 Jun 2011 at 6:55 AM. Reason: additional code.
    UI: Sencha Architect 3.x / ExtJS 4 & 5
    Server side: JEE / EJB 3.x / CDI / JPA 2.x/ JAX-RS / JasperReports
    Application Server: Glassfish / WildFly
    Databases: Oracle / DB2 / MySQL / Firebird

    If you like my answer please vote!

Thread Participants: 1