Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ListGrid: Unselect All?

    Is there a way to unselect everything on a gridlist?

    I have a button to add a new row in my grid. When I click on it, I want the selection to be on this new row and nothing else.
    I found a way to do it but it is ugly. There must be a easiest way...

    Here is what I done. "clustersListGrid" is my ListGrid.
    Code:
    ...
    public void onClick( final ClickEvent iClickEvent )
    {
        int lGridSize = clustersListGrid.getDataAsRecordList().getLength();
        int[] lSelectedIndex = new int[lGridSize];
        for ( int i = 0; i < lSelectedIndex.length; i++ )
        {
            lSelectedIndex[i] = i;
        }
        clustersListGrid.selectRecords( lSelectedIndex, false );
        clustersListGrid.startEditingNew();
    
        ....
    }
    ...
    As you can see, I have to create my own array of index of all the records before being able to use the "selectRecords( int[], boolean )" method.
    That is pretty ugly!

    I think there should be a method like "unselectAll()" or "selectOnEditing(boolean)". Or even a "selectOnEditingNew(boolean)".

    What do you think?

    #2
    deselectAllRecords();
    startEditingOnNew();

    Comment

    Working...
    X