Skip to content

Instantly share code, notes, and snippets.

@MihailoJoksimovic
Created June 13, 2013 12:24
Show Gist options
  • Save MihailoJoksimovic/5773275 to your computer and use it in GitHub Desktop.
Save MihailoJoksimovic/5773275 to your computer and use it in GitHub Desktop.
toggleRow: function(rowIdx, record) {
var me = this,
view = me.view,
rowNode = view.getNode(rowIdx),
row = Ext.fly(rowNode, '_rowExpander'),
nextBd = row.down(me.rowBodyTrSelector, true),
isCollapsed = row.hasCls(me.rowCollapsedCls),
addOrRemoveCls = isCollapsed ? 'removeCls' : 'addCls',
rowHeight;
// Suspend layouts because of possible TWO views having their height change
Ext.suspendLayouts();
row[addOrRemoveCls](me.rowCollapsedCls);
Ext.fly(nextBd)[addOrRemoveCls](me.rowBodyHiddenCls);
me.recordsExpanded[record.internalId] = isCollapsed;
view.refreshSize();
view.fireEvent(isCollapsed ? 'expandbody' : 'collapsebody', row.dom, record, nextBd);
// Sync the height and class of the row on the locked side
if (me.grid.ownerLockable) {
view = me.grid.ownerLockable.lockedGrid.view;
rowHeight = row.getHeight();
row = Ext.fly(view.getNode(rowIdx), '_rowExpander');
row.setHeight(rowHeight);
row[addOrRemoveCls](me.rowCollapsedCls);
view.refreshSize();
}
// Coalesce laying out due to view size changes
Ext.resumeLayouts(true);
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment