X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/0494b8d9b9bb03ab6c22b34dae81261e3cd7e3e6..7a654f8d43fdb43d78b63d90528bed6e86b608cc:/src/grid/feature/RowWrap.js?ds=inline diff --git a/src/grid/feature/RowWrap.js b/src/grid/feature/RowWrap.js new file mode 100644 index 00000000..7b06dbe3 --- /dev/null +++ b/src/grid/feature/RowWrap.js @@ -0,0 +1,78 @@ +/** + * @class Ext.grid.feature.RowWrap + * @extends Ext.grid.feature.Feature + * @private + */ +Ext.define('Ext.grid.feature.RowWrap', { + extend: 'Ext.grid.feature.Feature', + alias: 'feature.rowwrap', + + // turn off feature events. + hasFeatureEvent: false, + + mutateMetaRowTpl: function(metaRowTpl) { + // Remove "x-grid-row" from the first row, note this could be wrong + // if some other feature unshifted things in front. + metaRowTpl[0] = metaRowTpl[0].replace(Ext.baseCSSPrefix + 'grid-row', ''); + metaRowTpl[0] = metaRowTpl[0].replace("{[this.embedRowCls()]}", ""); + // 2 + metaRowTpl.unshift(''); + // 1 + metaRowTpl.unshift('
'); + + // 3 + metaRowTpl.push('
'); + // 4 + metaRowTpl.push(''); + }, + + embedColSpan: function() { + return '{colspan}'; + }, + + embedFullWidth: function() { + return '{fullWidth}'; + }, + + getAdditionalData: function(data, idx, record, orig) { + var headerCt = this.view.headerCt, + colspan = headerCt.getColumnCount(), + fullWidth = headerCt.getFullWidth(), + items = headerCt.query('gridcolumn'), + itemsLn = items.length, + i = 0, + o = { + colspan: colspan, + fullWidth: fullWidth + }, + id, + tdClsKey, + colResizerCls; + + for (; i < itemsLn; i++) { + id = items[i].id; + tdClsKey = id + '-tdCls'; + colResizerCls = Ext.baseCSSPrefix + 'grid-col-resizer-'+id; + // give the inner td's the resizer class + // while maintaining anything a user may have injected via a custom + // renderer + o[tdClsKey] = colResizerCls + " " + (orig[tdClsKey] ? orig[tdClsKey] : ''); + // TODO: Unhackify the initial rendering width's + o[id+'-tdAttr'] = " style=\"width: " + (items[i].hidden ? 0 : items[i].getDesiredWidth()) + "px;\" "/* + (i === 0 ? " rowspan=\"2\"" : "")*/; + if (orig[id+'-tdAttr']) { + o[id+'-tdAttr'] += orig[id+'-tdAttr']; + } + + } + + return o; + }, + + getMetaRowTplFragments: function() { + return { + embedFullWidth: this.embedFullWidth, + embedColSpan: this.embedColSpan + }; + } + +}); \ No newline at end of file