Hybrid View

  1. #1
    Sencha Premium Member
    Join Date
    Jan 2009
    Posts
    314
    Vote Rating
    46
    firefoxSafari has a spectacular aura about firefoxSafari has a spectacular aura about firefoxSafari has a spectacular aura about

      0  

    Default Devs please give option to select text in a grid

    Devs please give option to select text in a grid


    It seems like it's a very common requirement to select text in a grid. I know my users demand it. There is an override for it in the grid faq for Ext 3. I just spent the last half hour or so trying to apply it to 4. It's similar, but now I have to override both View and TableChunker.

    It was a good experience and I learned some new things about 4, but now I'm asking myself why. It seems like this long standing workaround deserves a new feature. Since you're so radically, redesigning the grids anyway, could you just give us a config option to make the text selectable and save everyone the hassle of having to find the overrides?

    The same can be said for some of the other long standing grid cosmetic issues - letting lines wrap, for example, could be a config option.

  2. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    8,882
    Vote Rating
    101
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    We're listening... Any of the small feature requests that you want like this, please be sure to post and we'll try to implement them in the 4.x line.

    Thanks,
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  3. #3
    Sencha Premium Member
    Join Date
    Jan 2009
    Posts
    314
    Vote Rating
    46
    firefoxSafari has a spectacular aura about firefoxSafari has a spectacular aura about firefoxSafari has a spectacular aura about

      0  

    Default


    Sweet - thank you very much for considering implementing these features.

    It is much appreciated to have the senior developers taking time to respond to feedback like this!

  4. #4
    Ext JS Premium Member
    Join Date
    Mar 2010
    Location
    Barcelona
    Posts
    33
    Vote Rating
    1
    deister is on a distinguished road

      0  

    Default


    +1 on this.

    I tried without success to remove the "x-unselectable" class from the table markup using a grid feature:

    Code:
    Ext.define('Webos.grid.feature.Selectable', {
        extend: 'Ext.grid.feature.Feature',
        alias: 'feature.selectable',
        mutateMetaRowTpl : function(metaRowTpl) {
            var len = metaRowTpl.length;
            for (var idx = 0; idx < len; idx++) {
                metaRowTpl[idx] = metaRowTpl[idx].replace("x-unselectable","").replace('unselectable=\"on\"',"")
            }
    
        }
    });

    Any ideas?

  5. #5
    Sencha Premium Member
    Join Date
    Jan 2009
    Posts
    314
    Vote Rating
    46
    firefoxSafari has a spectacular aura about firefoxSafari has a spectacular aura about firefoxSafari has a spectacular aura about

      0  

    Default


    If you don't mind doing this for every grid on the page, I'd take the direct route and override the templates that generate the html.

    Both the Ext.view.TableChunker.metaRowTpl and the Ext.grid.View cls default must be modified. As an added bonus, refresh on Ext.view.Table invokes table.unselectable so you have to override this method, too.

    Something like:

    Code:
     <style type="text/css">
       .x-selectable, .x-selectable * {
       -moz-user-select: text!important;
       -khtml-user-select: text!important;
      }
     </style>
     
    ...
     
     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 class="' + Ext.baseCSSPrefix + 'grid-cell-inner ' + Ext.baseCSSPrefix + 'selectable" style="{{id}-style}; text-align: {align};">{{id}}</div></td>',
                    '</tpl>',
                '</tr>'
            ];
      
      Ext.override(Ext.grid.View, {
       cls: Ext.baseCSSPrefix + 'grid-view ' + Ext.baseCSSPrefix + 'selectable'
      });
        
      Ext.override(Ext.view.Table, {
          refresh: function(firstPass) {
              var me = this,
                  table;
              //this.saveScrollState();
              me.setNewTemplate();
              
              // The table.unselectable() call below adds a selectstart listener to the table element.
              // Before we clear the whole dataview in the callParent, we remove all the listeners from the
              // table. This prevents a big memory leak on IE6 and IE7.
              if (me.rendered) {
                  table = me.el.child('table');
                  if (table) {
                      table.removeAllListeners();
                  }
              }
              
              me.callParent(arguments);
              //this.restoreScrollState();
              if (me.rendered) {
                  // Make the table view unselectable
                  table = me.el.child('table');
                  if (table) {
                      //table.unselectable();
                  }
                  
                  if (!firstPass) {
                      // give focus back to gridview
                      me.el.focus();
                  }
              }
          }
      });
    I'd love to hear a better way of doing this...

    I really, really wish this had made it into the final 4 release. The workaround for selecting text in 3.x was much easier... I just don't understand why Sencha thinks we don't need this feature. It's been in the Grid Faq for 2-3 forever. IMHO, incorporating all the hacks and workarounds from the FAQ's should have been step number 1 in the redesign process. Why make us reinvent this again?

  6. #6
    Sencha User ykey's Avatar
    Join Date
    Mar 2010
    Location
    USA
    Posts
    245
    Vote Rating
    27
    ykey has a spectacular aura about ykey has a spectacular aura about

      0  

    Default


    Why was the decision made to make grid column text unselectable to begin with? Does it somehow reduce the user experience? I would say more than half of the other JavaScript based grid widgets I have found on the net also restrict cell text selection.

  7. #7
    Sencha User
    Join Date
    Aug 2010
    Posts
    45
    Vote Rating
    0
    daddie888 is on a distinguished road

      0  

    Default


    i second your plea, nice work !

  8. #8
    Sencha User
    Join Date
    Mar 2010
    Posts
    83
    Vote Rating
    -1
    daiei27 is an unknown quantity at this point

      0  

    Default


    Quote Originally Posted by firefoxSafari View Post
    It seems like it's a very common requirement to select text in a grid. I know my users demand it. There is an override for it in the grid faq for Ext 3. I just spent the last half hour or so trying to apply it to 4. It's similar, but now I have to override both View and TableChunker.

    It was a good experience and I learned some new things about 4, but now I'm asking myself why. It seems like this long standing workaround deserves a new feature. Since you're so radically, redesigning the grids anyway, could you just give us a config option to make the text selectable and save everyone the hassle of having to find the overrides?

    The same can be said for some of the other long standing grid cosmetic issues - letting lines wrap, for example, could be a config option.
    +50 or so according to this thread with the original workaround.
    http://www.sencha.com/forum/showthre...l=1#post205984

    I know of several other random threads on the subject but don't feel like searching them out...

    I'm in the same boat. I did this in 3.x, but want to avoid overrides as much as possible since they are obviously hard to maintain so I'd like to wait until something more official is created. Perhaps some sort of addition to the selection models?

  9. #9
    Sencha User littletree's Avatar
    Join Date
    Jun 2011
    Location
    USA
    Posts
    17
    Vote Rating
    0
    littletree is on a distinguished road

      0  

    Default


    +1. An "excel" like grid would be a common use case, would it not? It would be really nice to drag over a range of cells, then copy and paste into a spreadsheet...

  10. #10
    Sencha User
    Join Date
    Aug 2011
    Location
    China
    Posts
    31
    Vote Rating
    0
    kyousuke is on a distinguished road

      0  

    Default


    +1

Similar Threads

  1. Cannot select text(only in Firefox) in Grid plugins
    By sandeepdreddy in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 8 Nov 2010, 11:43 AM
  2. how can i give link to text in grid column
    By vijaypatil12 in forum Ext 3.x: Help & Discussion
    Replies: 5
    Last Post: 29 Oct 2010, 1:40 AM
  3. Select text inside grid
    By atiqul in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 26 Apr 2010, 6:37 AM
  4. Ext.form.ComboBox javascript equivalent of select option text?
    By summer00 in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 21 Apr 2010, 5:40 AM

Thread Participants: 23

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar