Question

I have problem configuring RowExpander for my grid. When the grid renders the expander is already opened for each row and with nothing inside. When i click on its icon the following error is generated: nextBd is null. I found very similar problem here http://www.sencha.com/forum/showthread.php?185837-Grid-Panel-PlugIn-Rowexpander-nextBd-is-null but the solution does not work for me and still dont get it why plugin config cannot be passed in initComponent method:

Here is my grid code:



    Ext.define('GSIP.view.plans.PlanReqList' ,{
        extend: 'Ext.grid.Panel',
        alias : 'widget.gsip_devplan_list',
        id: 'gsip_plan_list',
        plugins: [{
            ptype: 'rowexpander',
            rowBodyTpl : [
                'Nazwa:{name}'
            ]
        }],
        //title:i18n.getMsg('gsip.view.PlanReqList.title'), 
        layout: 'fit',
        initComponent: function() {


            this.store = 'DevPlan';

    //      this.plugins = [{
    //            ptype: 'rowexpander',
    //            rowBodyTpl : [
    //                {name}
    //            ]
    //        }];

            this.features = [{ftype:'filters', encode:false, local:true},{ftype:'grouping'}];

            this.tbar = [{
                xtype:'commandbutton',
                id: 'newReq',
                iconCls:'icon-application_add',
                text: i18n.getMsg('gsip.view.plans.PlanReqList.addReq'),
                command: 'newReq',
            }];

            this.viewConfig = {
                forceFit:true,
                getRowClass: function(record, index) {
                    var c = record.get('elapsedPercent');
                    if (c >= 0) {                   
                        return 'elapsed-normal';
                    } 
                }
            }

            this.columns = [
                {header: "Id", dataIndex: "id", width:50, sortable: true, filter:{type:'numeric'}},
                {header: i18n.getMsg('gsip.view.plans.PlanReqList.column.name'), dataIndex: "name", flex:1, sortable: true, filter:{type:'string'} },

                }
            ];


            this.callParent(arguments);


        },

Was it helpful?

Solution

The rowexpander plugin makes use of a feature called rowbody.

In your initComponent() you override this.features (which already includes rowbody) with this line:

this.features = [{ftype:'filters', encode:false, local:true},{ftype:'grouping'}];

Thus the rowbody feature is not included; thus the .x-grid-rowbody-tr class is not injected; thus rowexpander can't find such class for nextBd and returns null.

You should try:

var iNewFeatures = [{ftype:'filters', encode:false, local:true},{ftype:'grouping'}];
this.features = iNewFeatures.concat( this.features );

Lastly, plugins cannot be initiated in InitComponent(), you can either declare them as configs, or within the constructor. See this thread for more info.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top