# Datagrid (list) sortItemsBy issue

**URL:** <https://forum.kirupa.com/t/datagrid-list-sortitemsby-issue/181491>\
**Category:** Uncategorized\
**Created:** [March 9, 2006, 7:55pm UTC](https://forum.kirupa.com/t/datagrid-list-sortitemsby-issue/181491 "2006-03-09T19:55:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mpelland](https://avatars.discourse-cdn.com/v4/letter/m/c0e974/32.png) [@mpelland](https://forum.kirupa.com/u/mpelland)\
**Post date:** [March 9, 2006, 7:55pm UTC](https://forum.kirupa.com/t/datagrid-list-sortitemsby-issue/181491/1 "2006-03-09T19:55:14Z")

</div>

hey all,  
so I have this code working in another part of my site but a couple of things have changed…

has anyone experienced issues with the sortItemsBy function? What is happening is that I have a button that switches the order of the contents of the grid. the problem is that it only switches on every second click.

here is the code

```auto

        column1_btn.onRelease = function () {
        
            if (this.sortDir != "DESC") {
                this.sortDir = "ASC";
            } else {
                this.sortDir = "DESC";
            }

            this.arrow_mc._rotation += 180;
            
            results_grd.sortItemsBy(column1Title, this.sortDir);
            
            //updateAfterEvent();
        }

```

lemme know,  
cheers!  
marc
