[ 
https://jira.jboss.org/jira/browse/RF-6439?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12473015#action_12473015
 ] 

Ryan Yoder commented on RF-6439:
--------------------------------

I have fixed this with a javascript override. 
I created an extendedDataTableFix.js file that I include on all pages which 
overrides their javascript with a copy of their current script with my fixes in 
it.
This works fine for me while they work out the bugs.

Here is the contents of the file for this fix.
I have also fixed the problem in IE where you get a null pointer when keying up 
past the first row.
This code was copied from the 3.3.0.GA-src tree under 
richfaces-ui-3.3.0.GA-src\richfaces-ui-3.3.0.GA\ui\extendedDataTable\src\main\javascript\ClientUI\controls\datatable.

I then put an if around the this.slectionManager in two places and I am 
correctly checking for the fakeIeRow in the keydown method.  Use at your own 
risk :)





if(window.ExtendedDataTable.DataTable)
{       
        
        
        // Fixes a null pointer bug in IE when in a modalPanel
        window.ExtendedDataTable.DataTable.prototype.update = 
function(refreshEvents) 
        {                       
                this.createControls();
        if ( !ClientUILib.isIE ) {
            if (this.fakeIeRow) {
                                
this.table.getElement().deleteRow(this.fakeIeRow.rowIndex);     
                                this.fakeIeRow = null;
                        }
                        if (this.fakeIeBodyRow) {
                                
                                
this.tableB.deleteRow(this.fakeIeBodyRow.rowIndex);
                                this.fakeIeBodyRow = null;
                        }
                };
                if(this.selectionManager) 
this.selectionManager.refreshEvents();        // added if
                this.updateLayout();
                if(this.selectionManager) this.selectionManager.restoreState(); 
        // added if
        }       
        
        window.ExtendedDataTable.SelectionManager.prototype.processKeyDown = 
function(event) 
        {       
                if ($(this.prefix + ":n").rows.length > 0) {
                        if(!event.shiftKey) {
                                this.shiftRow = null;
                        }               
                        var range, rowIndex;
                        var activeRow = this.activeRow;
                        var noDefault = false;
                        //var arr = $(this.prefix + 
":n").rows[0].id.split(":");        // ADDED THIS TO FIX KEYUP IN IE NULL 
POINTER
                        var firstRowIndex = this.dataTable.fakeIeRow?1:0;
                        var arr = $(this.prefix + 
":n").rows[firstRowIndex].id.split(":");
                        this.firstIndex = Number(arr[arr.length-1]);
                        switch (event.keyCode || event.charCode) {
                                case Event.KEY_UP:
                                        if (this.inFocus && activeRow != null) {
                                                if(this.firstIndex != 
activeRow) {
                                                        rowIndex = 
(this.rowCount + activeRow - 1) % this.rowCount;             
                                                        if (!event.ctrlKey && 
!event.shiftKey) {
                                                                
this.selectionFlag = "x";
                                                                range = 
[rowIndex, rowIndex];
                                                                
this.setSelection(range);               
                                                        } else if 
(!event.ctrlKey && event.shiftKey
                                                                     && 
this.options.selectionMode == "multi") {
                                                                
if(!this.shiftRow) {
                                                                        
this.shiftRow = this.activeRow;
                                                                }
                                                                
if(this.shiftRow >= this.activeRow) {
                                                                        
this.addRowToSelection(rowIndex);                                               
                                                                } else {
                                                                        
this.removeRowFromSelection(activeRow);                                         
                                                                }
                                                        }
                                                        noDefault = true;
                                                        
this.setActiveRow(rowIndex);
                                                } else {
                                                        
//this.grid.getBody().showRow("up");                                    
                                                }
                                        }
                                        break;
                                case Event.KEY_DOWN:
                                        if (this.inFocus && activeRow != null) {
                                                rowIndex = (activeRow + 1) % 
this.rowCount;             
                                                if(this.firstIndex != rowIndex) 
{
                                                        if (!event.ctrlKey && 
!event.shiftKey) {
                                                                
this.selectionFlag = "x";
                                                                range = 
[rowIndex, rowIndex];
                                                                
this.setSelection(range);               
                                                        } else if 
(!event.ctrlKey && event.shiftKey
                                                                     && 
this.options.selectionMode == "multi") {
                                                                
if(!this.shiftRow) {
                                                                        
this.shiftRow = this.activeRow;
                                                                }
                                                                
if(this.shiftRow <= this.activeRow) {
                                                                        
this.addRowToSelection(rowIndex);                                               
                                                                } else {
                                                                        
this.removeRowFromSelection(activeRow);                                         
                                                                }
                                                        }
                                                        noDefault = true;
                                                        
this.setActiveRow(rowIndex);
                                                } else {
                                                        
//this.grid.getBody().showRow("down");                                  
                                                }
                                        }
                                        break;
                                case 65: case 97:                               
                                // Ctrl-A
                                        if (this.inFocus && event.ctrlKey) {
                                                this.selectionFlag = "a";
                                                for (var i = 0; i <  
this.rowCount; i++) {
                                                        
this.addRowToSelection(i);
                                                }
                                                noDefault = true;
                                        }
                                        break;
                                case Event.KEY_TAB:
                                        this.lostFocus();
                        }
                        if (noDefault) {
                                this.dataTable.showRow(this.activeRow);
                                this.selectionChanged(event);                   
                                if (event.preventBubble) event.preventBubble();
                                Event.stop(event);
                        }
                }
        }
        
}



> ExtendedDataTable in modal panel - undefined this.selectionManger
> -----------------------------------------------------------------
>
>                 Key: RF-6439
>                 URL: https://jira.jboss.org/jira/browse/RF-6439
>             Project: RichFaces
>          Issue Type: Bug
>    Affects Versions: 3.3.0
>         Environment: IE7
>            Reporter: Nick Belaevski
>            Assignee: Piotr Kawiak
>             Fix For: Future
>
>
>       <rich:modalPanel id="panelDoc" width="650" height="650">
>               <f:facet name="header">
>                       <h:panelGroup>Doc</h:panelGroup>
>               </f:facet>
>               <f:facet name="controls">
>                       <h:panelGroup>
>                               <h:graphicImage value="/img/break.gif" 
> style="cursor: pointer;">
>                                       <rich:componentControl for="panelDoc" 
> operation="hide" event="onclick"/>
>                               </h:graphicImage>
>                       </h:panelGroup>
>               </f:facet>
>               <h:form>
>               <rich:extendedDataTable value="#{forum5Bean.data}" var="field1" 
> id="extData">
>                       <rich:column>#{field1}</rich:column>
>               </rich:extendedDataTable>
>               </h:form>
>       </rich:modalPanel>
>       <h:form> 
>               <a4j:commandLink value="open panel" reRender="extData" 
> oncomplete="Richfaces.showModalPanel('panelDoc');"/>
>       </h:form>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
richfaces-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/richfaces-issues

Reply via email to