Newbie: sort listgrid, demo example remoteArray.xml

Hi,

I would like to sort a listgrid. I based my code on the remoteArray.xml example.
And I don't find how to make it work. Can anybody help me?

Thanks!

Code

Sylvie, can you include your code (use   tags around it) and describe in more detail what the problem is ?

my code

Here's my code. It works fine. The only problem is that when I click on the columns headers, it sends a request but nothing is sorted. It set by default? I tried sortable="true" but same problem.

<b:tab label="Example">
<b:dataSource name="myData" url="../index.cfm" type="array" dataRoot="mybookmarks">
        <b:dataSchema>
                <b:dataField name="title" key="title" />
        </b:dataSchema>
</b:dataSource>


<b:listGrid dataSource="myData" readonly="true" width="100%" height="100%" rowClasses="rowClass1, rowClass2">
        <b:listGridCol query="title" label="Title"/>
        <b:listGridCol query="internal_url" label="Internal" />
        <b:listGridCol query="external_url" label="External" />
</b:listGrid>
</b:tab>

Founded, variables catched in the script file

Ok, I have found the solution. The fact is that you have to catch the variables: sortDirection and sortValue in the script file. I add my coldfusion query code for the example, hope it helps s.o else.

<cfinclude template="jsonencode.cfm">
<cfquery name="get_bookmarks_count" datasource="bookmarks">
        SELECT COUNT(*) AS count FROM bookmarks
</cfquery>

<cfoutput>
        <cfif isDefined("sortDirection") AND sortDirection IS "ascending">
                <cfset sense = "ASC">
        <cfelseif isDefined("sortDirection") AND sortDirection IS "descending">
                <cfset sense = "DESC">
        </cfif>
        <cfquery name="get_bookmarks" datasource="bookmarks">
                SELECT * FROM bookmarks
                <cfif isDefined("sortValue")>
                        ORDER BY #sortValue# #sense#
            </cfif>
        </cfquery>
</cfoutput>