-
1 May 2012 3:12 AM #1
Adding components to grid rowBody feature or rowExpander
Adding components to grid rowBody feature or rowExpander
Is it possible to add panels etc to a grid's rowBody feature or rowExpander plugin? If so, how do I do it?
Ideally, I'd like the row expander to open up a sub-panel in the grid that shows a mini-tab panel with edit facilities.
All help more than welcome
I'm trying the following.
I have also tried rendering a panel to the 'ANDY' div, created in the rowexpander template (commented out above), when the expandbody is firedCode:Ext.define('ARC.view.communicate.ContactList', { alias: 'widget.contactlist' ,extend: 'Ext.grid.Panel' ,requires: [ 'Ext.ux.RowExpander' ] ,plain: true ,loadMask: true ,verticalScroller: {xtype: 'paginggridscroller', activePrefetch: false} ,viewConfig: { trackOver: false ,singleSelect: true } /* ,plugins: [{ ptype: 'rowexpander' ,rowBodyTpl : [ '<div id="ANDY"> </div>' ] }] */ ,features: [{ ftype: 'rowbody' , getAdditionalData: function(data, idx, record, orig) { return { rowBody:Ext.panel.Panel({title: 'TITLE', height: 200, width: 200})}; } }, { ftype: 'rowwrap' }] ......
Code:,onExpandBody: function(rowNode, record, expandRow) { console.log('rowNode',rowNode); console.log('record',record); console.log('expandRow',expandRow); var rowBody = Ext.get('ANDY'); Ext.create({ xtype: 'panel' ,title: 'title' ,height: 200 ,width: 200 ,renderTo: rowBody }); }
-
1 May 2012 11:56 AM #2
And the answer is:
Code:Ext.grid.Panel ......... ,plugins: [{ ptype: 'rowexpander' ,rowBodyTpl : [ '<div id="contact-row-{contactid}"> </div>' ] }] .........Code:controller ,init: function() { this.control({ 'contactlist gridview' : {expandbody: this.onExpandBody} }) } ,onExpandBody: function(rowNode, record, expandRow) { var row = 'contact-row-' + record.get('contactid'); var andyPanel = Ext.create(Ext.panel.Panel,{ ,title: 'title' ,height: 200 ,width: 200 }); andyPanel.render(row); }
-
29 Jul 2012 3:18 PM #3
Hi,
This approach works but is not the best solution using ExtJS MVC.
Let me explain why:
When you render the component to a DOM element, the component cannot hierarchically be reached by Ext.ComponentQuery, because it is not a child of any component.
This means that you cannot find the component using ComponentQuery like this:
You can only find it directly:Code:Ext.ComponentQuery.query('#mygrid #myAddedComponent');
So far I haven't found a solution for this problem.Code:Ext.ComponentQuery.query('#myAddedComponent');
Maybe the solution would be to convert theinto a component and register it to the Ext.Component Manager.Code:<div id="contact-row-{contactid}"> </div>
I hope someone can help me with this problematic.
Thanks.Using Ext with cachefly
Working on LAMPExt


Reply With Quote