:: Forum >>

Bug with multiselect -> ctrl-click

Hi,

I want to report on a bug I encountered when I use the multiselect. Perhaps I am doing something wrong or missed out on a previous post, but here's the deal:

I have enabled multiselect and it works fine, unless the following actions are executed:
1. Open a multiselect grid without any selection set.
2. Ctrl-click right away on any item, before selecting a row without holding the ctrl-button.

I try to fetch my data as always like this:
function onSelectionChanged(src) {
        var row = src.getSelectionProperty("index");
        var id = this.getDataProperty("text", row, 0);
// Do something
    }


However, src.getSelectionProperty("index"); does not work because 'myData[...] is null or not an object', according to IE.

When I first select an item without holding the ctrl-button, deselect it and then repeat the steps described above, the selection does function as expected.

Why does it not in the first place?

Regards,
Yereth

ps. You've done really a great job with creating the grid. My compliments!
Yereth
Monday, May 23, 2005
Oops,

I can give a more specific error;

var row = src.getSelectionProperty("index");
--> row = -1;

So obviously that's why it can't retreive the data using 'this.getDataProperty("text", row, 0)', as rownumber = -1 is not exactly in the data model.

So the problem is that getSelectionProperty does not seem to be working correctly in the situation described above, returning -1 while an item was selected using ctrl-click.

Regards,
Yereth
Yereth
Monday, May 23, 2005
Try getProperty("selection/index")

I don't use getSelectionProperty("index") but have no problems with getProperty("selection/index").
Jim Hunter
Tuesday, July 19, 2005
Thanks, but it didn't change a thing.

It only occurs when multiselect is on and when I load the grid and the VERY FIRST action I perform is click while holding the CTRL-key. Now this should be possible of course.
Yereth
Wednesday, August 31, 2005
We have solved the ctrl-click bug. The problem was that the newly selected row was being pushed to the selection array in the selectMultipleRows function when the array should have been updated instead. I've included the code with the necessary changes to fix the bug. Check the comments in the code for the lines you should replace.

var selectMultipleRows=function( src )
{
if(!this.getSelectionProperty( "multiple" ) )
{
return this.action( "selectRow",src )
}
var index=src.getItemProperty( "index" );
var selection=this.getSelectionProperty( "values" );

for( var i=0; i<selection.length; i++ )
{
if( selection[ i ]==index )
{
selection.splice( i, 1 );
i=-1;
break
}
}
// This is the section to change
// You shoule replace this:
// if( i!=-1 )
// {
// selection.push( index )
// }
// with this:
if( selection.length==1 && selection[ 0 ]==-1 )
{
selection[ 0 ] = index;
}
else if( i>0 )
{
selection.push( index )
}

this.setSelectionProperty( "values", selection );
setSelectionIndex.call( this, index );
this.getRowTemplate( index ).refreshClasses();
this.action( "selectionChanged" )
};
Kevin
Thursday, December 15, 2005

This topic is archived.


Back to support forum

Forum search