Thank you. I'll take a look at that.
Printable View
Thank you. I'll take a look at that.
problem 1:
in IE, when multi-select with SHIFT key, all the text will be selected
problem 2:
override of prototype.templates
see this thread:
http://www.sencha.com/forum/showthre...id-quot-in-FAQ
Thanks, Condor and DK!
(Was this enabled by default in 2.1, I wonder....)
I found a problem if there a second row in the grid defined in the getRowClass method.
I've noticed that second row disappear because something beyond my understandings happens in the next line:
Then I've noticed that another solution that allows you to select text in a grid, is just to return the x-selectable class in the getRowClass, but I've only tested on Firefox.Code:Ext.grid.GridView.prototype.templates = {};
Condor would you be kind and tell me if it's ok to use the following code in order to aviod the problem that I've mention above:Code:viewConfig: {
getRowClass: function(record, rowIndex, rp, ds){
return "x-selectable";
}
}
The code above makes the text selectable in all grids and you also have the second row in the grid display.Code:Ext.override(Ext.grid.GridView, {
cellTpl: new Ext.Template(
'<td class="x-grid3-col x-grid3-cell x-grid3-td-{id} x-selectable {css}" style="{style}" tabIndex="0" {cellAttr}>',
'<div class="x-grid3-cell-inner x-grid3-col-{id}" {attr}>{value}</div>',
'</td>'
)
});
Please note that in order to be able to select the text in the second row also the getRowClass must return the x-selectable class.
Your override should ofcourse only contain the second cellTpl, and yes, it will also work (but only on Ext 3.3+, because older versions didn't have a cellTpl GridView property).
ups, I updated the code.
thz for the answer
Thanks for the contribution Condor. I'm trying to do the same in Ext JS 4 but I'm not exactly sure which class I should override. I see the code in the distro, but I can't seem to override it without a JavaScript error.
I also tried this CSS override which works fine for FF but not for webkit browsers:Code:Ext.override( Ext.view.TableChunker, {
metaRowTpl: [
'<tr class="' + Ext.baseCSSPrefix + 'grid-row {addlSelector} {[this.embedRowCls()]}" {[this.embedRowAttr()]}>',
'<tpl for="columns">',
'<td class="{cls} ' + Ext.baseCSSPrefix + 'grid-cell ' + Ext.baseCSSPrefix + 'grid-cell-{columnId} {{id}-modified} {{id}-tdCls} {[this.firstOrLastCls(xindex, xcount)]}" {{id}-tdAttr}><div unselectable="off" class="' + Ext.baseCSSPrefix + 'grid-cell-inner ' + Ext.baseCSSPrefix + 'unselectable" style="{{id}-style}; text-align: {align};">{{id}}</div></td>',
'</tpl>',
'</tr>'
]
});
Thoughts to get this working in Ext JS 4?Code:<style type="text/css">
.x-unselectable, .x-unselectable * {
-moz-user-select: inherit !important;
-webkit-user-select: text !important;
-khtml-user-select: text !important;
}
</style>
I too would love the ability to select text in a grid in this way. I want to be able to swipe and copy all table contents.
Hi everyone
I just want to be able to select text from a TreeGrid panel cells. I tried all the mentioned way but no result. please help. thanks :-/
it serious