Hi!
Thanks for the fast reply. This is the code that is executed whenever the user
presses the
add user button:
private function addUser():void {
//Re-sort on the id field
var reSort:Sort = new Sort();
reSort.fields = [new SortField("id")];
this.userList.sort = reSort;
this.userList.refresh();
this.userList.addItem(new SVNUser(userList.length));
var editPosition:Object = new Object();
editPosition.columnIndex = 0;
editPosition.rowIndex = userList.length - 1;
this.userGrid.editedItemPosition = editPosition;
}
As you can see, I set the ArrayCollection's sort to the id column, add a new
item to it and
then focus the user input to the added line in the DataGrid. This works fine as
the selected
item on the grid is always the one that was added (if I did't reset the sort to
the id field,
the line would be inserted in a different position according to the active
sort). The
problem is that the grid still displays the arrow on the column by which it was
being
sorted.
Again, thanks.
Rui Duarte Silva
--- In [email protected], "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> If you set the sort with only one sortField, the DG should reflect that.
> Maybe you can post a test case?
>
> ________________________________
>
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of ruidsoares
> Sent: Wednesday, November 28, 2007 7:59 AM
> To: [email protected]
> Subject: [flexcoders] How to remove the current sort on a Datagrid
>
>
>
> Hi,
>
> I have a Datagrid that the user is able to edit directly. He is also
> allowed to add a new item
> in the grid. This is done by using addItem on the ArrayCollection that
> serves as the data
> provider for the grid. After that I use the editedField method of the
> datagrid to give focus
> to the first column of the newly created line so that the user is able
> to insert the
> information right away. I use as rowIndex the dataProviders length - 1.
>
> The problem is that when the grid is sorted by one of its three columns
> the
> dataProvider.lemgth - 1 no longer points to the inserted row. I
> successfully resorted the
> dataProvider using a new field with sequential number and replacing the
> sort on the
> ArrayCollection with a new one that uses this new field. So, the
> dataProvider.length - 1
> points to the last row (just inserted). The new column is not displayed,
> it's just there for
> control.
>
> The problem now is that the DataGrid still displays the arrow on the
> column by which it
> was last sorted effectively deceiving the user into thinking that the
> sort has not changed.
>
> Does anyone know how to solve this?
>
> Thanks
>