Announcement

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

    Sorting dates

    This is with Smartgwtpro 2.3
    Firefox 3.6.8 and Chrome 5.0.375.127

    I am feeding a listgrid with a date object, and then telling the listgrid to sort by date. It successfully sorts by date, but always sorts it ascending, even though the little arrow indicates descending order.

    http://grab.by/63CO

    If you click the header and resort descending it sorts the correct way. I have also tried to just call a sort which also didn't work.

    Am I making a mistake somewhere, or is there a bug?

    Code
    Code:
            notificationGrid = new ListGrid();
            notificationGrid.setAutoFetchData(false);
            notificationDS = DataSource.get("notification");
            notificationGrid.setDataSource(notificationDS);
            notificationGrid.setSortField("modification_date");
            notificationGrid.setSortDirection(SortDirection.DESCENDING);
            notificationGrid.fetchData();
    The request
    Code:
    {
        "actionURL":"http://127.0.0.1:8888/program/sc/IDACall", 
        "showPrompt":true, 
        "prompt":"Finding Records that match your criteria...", 
        "transport":"xmlHttpRequest", 
        "promptStyle":"dialog", 
        "bypassCache":true, 
        "data":{
            "criteria":{
            }, 
            "operationConfig":{
                "dataSource":"notification", 
                "repo":null, 
                "operationType":"fetch", 
                "textMatchStyle":"exact"
            }, 
            "startRow":0, 
            "endRow":75, 
            "sortBy":[
                "modification_date"
            ], 
            "componentId":"isc_ListGrid_0", 
            "appID":"builtinApplication", 
            "operation":"notification_fetch", 
            "oldValues":{
            }
        }
    }
    Response
    Code:
    [
        {
            endRow:4, 
            totalRows:4, 
            isDSResponse:true, 
            invalidateCache:false, 
            status:0, 
            startRow:0, 
            data:[
                {
                    modification_date:new Date(1270443600000), 
                    description:"Zasdf", 
                    notification_id:7
                }, 
                {
                    modification_date:new Date(1273035600000), 
                    description:"Appointment confirmed", 
                    notification_id:4
                }, 
                {
                    modification_date:new Date(1273035600000), 
                    description:"Appointment confirmed", 
                    notification_id:8
                }, 
                {
                    modification_date:new Date(1275714000000), 
                    description:"Appointment confirmed with John smith", 
                    notification_id:6
                }
            ]
        }
    ]
    the DS file
    Code:
    <DataSource ID="notification" serverType="sql" tableName="notification">
    	<fields>
    		<field name="notification_id" type="sequence" hidden="true"	sequenceName="notification_notification_id_seq" primaryKey="true" />
                    <field name="modification_date" title="Date" type="date" />
    		<field name="description" type="text" />
        </fields>
    </DataSource>

    #2
    I also tried this using the description field, which is just text, and it had the exact same behavior as the date field.

    Comment


      #3
      We tried this out and it is a bug. Thanks for the clear test case.
      We've added a fix to our mainline codebase which should resolve this for you. Give it a try with the next nightly build and let us know if you still see the problem

      Regards
      Isomorphic Software

      Comment

      Working...
      X