1. #1
    Ext User
    Join Date
    Oct 2008
    Posts
    195
    Vote Rating
    0
    aj3423 is on a distinguished road

      0  

    Default how to fix "select text in the grid" in FAQ?

    how to fix "select text in the grid" in FAQ?


    I tried the code on FAQ with the "basic grid" example:
    Code:
    <style type="text/css">
    	.x-selectable, .x-selectable * {
    		-moz-user-select: text!important;
    		-khtml-user-select: text!important;
    	}
    </style>
    Code:
    if (!Ext.grid.GridView.prototype.templates) {
       Ext.grid.GridView.prototype.templates = {};
    }
    Ext.grid.GridView.prototype.templates.cell = 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>'
    );

    the text selection is enabled, but when holds SHIFT to multi-select, all the rest text are selected, any idea about this?
    Thanks.
    grid selection.png

  2. #2
    Ext User
    Join Date
    Oct 2008
    Posts
    195
    Vote Rating
    0
    aj3423 is on a distinguished road

      0  

    Default


    anyone has idea about this?

  3. #3
    Ext User
    Join Date
    Oct 2008
    Posts
    195
    Vote Rating
    0
    aj3423 is on a distinguished road

      0  

    Default


    Firefox is ok, the problem is IE
    I tried this hack:
    when SHIFT key is down, disable the browser's select behaviour, and restore it when SHIFT key is up
    Code:
    Ext.getDoc().on('keydown', function(e) {
    		var SHIFT = 16;
    		if(e.keyCode === SHIFT) {
    			document.onselectstart = function() {
    				return false;
    			};
    		}
    	});
    	Ext.getDoc().on('keyup', function(e) {
    		var SHIFT = 16;
    		if(e.keyCode === SHIFT) {
    			document.onselectstart = function() {
    				return true;
    			};
    		}
    	});
    but it has some side effects, such as you cannot select text with SHIFT key in TextField, maybe it will cause some other issues?
    any better solution?

  4. #4
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,498
    Vote Rating
    46
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    I think IE requires that you actually poke a "unselectable" attribute into the DOM element you want to be unselectable.

    Nothing as simple and flexible as a style property for MS!

  5. #5
    Ext User
    Join Date
    Oct 2008
    Posts
    195
    Vote Rating
    0
    aj3423 is on a distinguished road

      0  

    Default


    but the "select text in the grid in FAQ" aims to enable the text selecting in the grid. this bug only happens when multi select with SHIFT key..

  6. #6
    Ext User
    Join Date
    Oct 2008
    Posts
    195
    Vote Rating
    0
    aj3423 is on a distinguished road

      0  

    Default


    Code:
    if (!Ext.grid.GridView.prototype.templates) {
       Ext.grid.GridView.prototype.templates = {};
    }
    this will cause another issue, if overriding the templates from prototype, all gridview will use the same templates attribute, if there are some extension like LockingGridView, they'll have their own templates, but in this case they'll override the prototype.templates, so templates of normal grid view will also be overridden.

    another way to override may be:
    Code:
    Ext.grid.GridView.prototype.initTemplates = 
    	Ext.grid.GridView.prototype.initTemplates.createSequence(function() {
    		console.info(this);
    		this.templates.cell = 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}" unselectable="on" {attr}>{value}</div>',
                '</td>'
            );
    	});

Similar Threads

  1. Grid.Select event can be "canceled" only in parts
    By Reghin in forum Ext GWT: Discussion
    Replies: 6
    Last Post: 24 Aug 2009, 8:09 AM
  2. Hint about "Altering Standard Panel Layout" [layout FAQ]
    By mabra in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 12 Aug 2009, 1:30 PM
  3. [CLOSED] grid: event "select" instead of "rowclick"
    By LorenzoW in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 22 Jan 2008, 4:40 AM
  4. "FireFox2 kills cursor" and text-select in toolbar
    By brian in forum Ext 1.x: Bugs
    Replies: 8
    Last Post: 7 Jun 2007, 12:12 AM

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."