[CLOSED] Problem with selecting values in gridpanel with Checkboxselection model in firefox

  1. #1

    [CLOSED] Problem with selecting values in gridpanel with Checkboxselection model in firefox

    Hi

    I have a grid panel with checkboxselectionmodel. I want to copy text selection from grid panel.

    With reference to this link http://forums.ext.net/showthread.php...ridpanel/page2 , i modified the CSS and javascipt to select/copy value from grid panel.

    Its working in IE with Row or Checkboxselection model and Its working in Firefox with Rowselection model

    But not working in Firfox with Checkboxselection model

    Please suggest what i have to do

    Thanks
    Last edited by Daniil; Mar 01, 2012 at 7:15 PM. Reason: [CLOSED]
  2. #2
    CheckboxSelectionModel stops the MouseDown event from bubbling, it prevents a possibility to select a cell text.

    To fix I can suggest the following script.

    Example
    <ext:ResourcePlaceHolder runat="server" Mode="ScriptFiles" />
     
    <script type="text/javascript">
        Ext.grid.CheckboxSelectionModel.override({
            onMouseDown: function (e, t) {
                /* 
                If you want make selections only by checking the checkbox,
                add "&& t.className == 'x-grid3-row-checker'" to next if statement
               
                If you want to make selection only with Ctrl key pressed, add
                "&& e.ctrlKey" to next if statement
                */
            
                if (e.button !== 0 || this.isLocked()) {
                    return;
                }     
    
                if (this.checkOnly && t.className !== "x-grid3-row-checker") {
                    return;
                }
            
                if (this.ignoreTargets) {
                    var i = 0;
    
                    for (i; i < this.ignoreTargets.length; i++) {
                        if (e.getTarget(this.ignoreTargets[i])) {
                            return;
                        }
                    }
                }
    
                if (e.button === 0 &&
                        (this.keepSelectionOnClick === "always" || t.className === "x-grid3-row-checker") &&
                        t.className !== "x-grid3-row-expander" &&
                        !Ext.fly(t).hasClass("x-grid3-td-expander")) {
    
                    //e.stopEvent();
                    var row = e.getTarget(".x-grid3-row"),
                        index;
    
                    if (!row) {
                        return;
                    }
    
                    index = row.rowIndex;
    
                    if (this.keepSelectionOnClick === "withctrlkey") {
                        if (this.isSelected(index)) {
                            this.deselectRow(index);
                        } else {
                            this.selectRow(index, true);
                        }
                    } else {
                        if (this.isSelected(index)) {
                            if (!this.grid.enableDragDrop) {
                                if (this.allowDeselect === false) {
                                    return;
                                }
    
                                this.deselectRow(index);
                            } else {
                                this.deselectingFlag = true;
                            }
                        } else {
                            if (this.grid.enableDragDrop) {
                                this.deselectingFlag = false;
                            }
    
                            this.selectRow(index, true);
                        }
                    }
                }
            }    
        });
    </script>
    I'm not 100% sure it won't cause any backside effects, because CheckboxSelectionModel stops the MouseDown event on the ExtJS level (just not sure why it's done).
    Last edited by Daniil; Mar 15, 2012 at 8:05 AM.
  3. #3
    Hi Daniil,

    Thanks for the solution. Its working perfectly.

Similar Threads

  1. [CLOSED] Locking Grid with checkboxselection model
    By nhg_itd in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Mar 15, 2012, 6:02 AM
  2. [CLOSED] Problem with selecting values in gridpanel.
    By tlfdesarrollo in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Jan 16, 2012, 1:38 PM
  3. CheckboxSelection Model Event
    By BLOZZY in forum 1.x Help
    Replies: 2
    Last Post: Sep 07, 2010, 7:40 AM
  4. [CLOSED] CheckBoxSelection model
    By jwaite in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Feb 17, 2010, 7:33 AM
  5. [CLOSED] CheckboxSelection model and script in every response
    By tdracz in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 04, 2009, 11:09 AM

Posting Permissions