Created
June 13, 2013 12:24
-
-
Save MihailoJoksimovic/5773275 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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