Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 431120

Summary: [Table] Fixed Table Columns prevent Drag&Drop
Product: [RT] RAP Reporter: Missing name Mising name <Rene.Brandstetter>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: andreas.r.fischl.work, tbuschto
Version: unspecified   
Target Milestone: 2.3 M3   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
full error present by firefox none

Description Missing name Mising name CLA 2014-03-25 10:49:28 EDT
Created attachment 241226 [details]
full error present by firefox

If you want to add Drag&Drop support to a Table which uses the "Fixed Table Columns" feature you gain a JavaScript error with the message: "this._tree._rowContainer.indexOf is not a function".

The reason for this is located in the used implementation of the _rowContainer which is usually an instance of "rwt.widgets.base.GridRowContainer" and there and "indexOf" exists. But if you use the "Fixed Table Columns" feature the _rowContainer is an instance of "rwt.widgets.util.GridRowContainerWrapper" which doesn't has this method.

(As an attachment I added the full error output retrieved on a firefox because it contains the better details, but all other browser like chrome and IE have the same error.)
Comment 1 Tim Buschtoens CLA 2014-03-25 12:35:25 EDT
Should be a relatively easy to make the basics work, though there may be some difficulties with the drag feedback.
Comment 2 Missing name Mising name CLA 2014-03-26 05:36:34 EDT
(In reply to Tim Buschtoens from comment #1)
> Should be a relatively easy to make the basics work, though there may be
> some difficulties with the drag feedback.

Yes, you are right the fix is easy it just adding the following method to the "rwt/widgets/util/GridRowContainerWrapper.js" to the prototype definition:

rwt.widgets.util.GridRowContainerWrapper.prototype = {
...

indexOf : function( vChild ){
    var index = this._container[ 0 ].indexOf( vChild );
    if( index < 0 ){
        index = this._container[ 1 ].indexOf( vChild );
    }
    return index;
},

...

}


I will provide a gerrit review in the next couple days.
Comment 3 Ivan Furnadjiev CLA 2014-03-26 06:55:03 EDT
(In reply to comment #2)
> Yes, you are right the fix is easy it just adding the following method to the
> "rwt/widgets/util/GridRowContainerWrapper.js" to the prototype definition:
> 
> rwt.widgets.util.GridRowContainerWrapper.prototype = {
> ...
> 
> indexOf : function( vChild ){
> var index = this._container[ 0 ].indexOf( vChild );
> if( index < 0 ){
> index = this._container[ 1 ].indexOf( vChild );
> }
> return index;
> },
> 
> ...
> 
> }
> 
> 
> I will provide a gerrit review in the next couple days.
Is it better to simply add "indexOf" to rwt.widgets.util.GridRowContainerWrapper._CONTAINER_GETTER_DELEGATES. In both containers the indexOf function should return the same index. René, could you try if this works?
Comment 4 Missing name Mising name CLA 2014-03-27 03:28:31 EDT
(In reply to Ivan Furnadjiev from comment #3)
> (In reply to comment #2)
> > Yes, you are right the fix is easy it just adding the following method to the
> > "rwt/widgets/util/GridRowContainerWrapper.js" to the prototype definition:
> > 
> > rwt.widgets.util.GridRowContainerWrapper.prototype = {
> > ...
> > 
> > indexOf : function( vChild ){
> > var index = this._container[ 0 ].indexOf( vChild );
> > if( index < 0 ){
> > index = this._container[ 1 ].indexOf( vChild );
> > }
> > return index;
> > },
> > 
> > ...
> > 
> > }
> > 
> > 
> > I will provide a gerrit review in the next couple days.
> Is it better to simply add "indexOf" to
> rwt.widgets.util.GridRowContainerWrapper._CONTAINER_GETTER_DELEGATES. In
> both containers the indexOf function should return the same index. René,
> could you try if this works?

Hi Ivan,

I've tried it and this will not work because the rwt.widgets.util.GridRowContainerWrapper._CONTAINER_GETTER_DELEGATES are only calling the first container (=the fixed columns) and the row could either be in the first container or the second one (=the scrollable columns). So if you start drag in one of the scrollable columns the indexOf() will always return -1 instead of the index which could be gained by the second container.
Comment 5 Ivan Furnadjiev CLA 2014-03-27 04:02:09 EDT
I see. Thanks for the explanation.
Comment 6 Missing name Mising name CLA 2014-03-27 18:52:30 EDT
I've added the mentioned method to the rwt/widgets/util/GridRowContainerWrapper.js and pushed it to Gerrit: https://git.eclipse.org/r/24033
Comment 7 Tim Buschtoens CLA 2014-04-07 04:53:26 EDT
Was fixed in commit 985917cf72e3c4476f8b49788d0cacf4fa29b48a as suggested, test added in commit 7baeef4bf4aa09f9be1ef38f139aa8629aecb3d5.