Date column in a!gridField() sorting correctly by month/day, but ignoring year

Certified Senior Developer

I have a paging grid setup that allows users to sort records by a "date created" field.  

a!gridTextColumn(
    label:"Created Date",
    field:"createdDt",
    data:fn!text(local!dataSet.data.createdDt,"MMM DD, YYYY")
)

 

When sorting by the date column in the grid, the dates are ordered correctly by month/day, but ignoring the year column. (i.e: Ascending order: {Jan 22, 2017; Feb 15, 2015; March 9 2016; etc}, should be: {Feb 15, 2015; March 9 2016;Jan 22, 2017}).  I know paging grids only accept image and text column definitions, so is there anyway to enforce the correct sorting for a date value in a text column?
Thank you in advance!

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    As far as I'm aware, the definition of the gridTextColumn won't have any effect on how sorting works other than the "field" property, which tells the grid to pass the given field name back (through the saveInto) to the pagingInfo, where the datasubset / query functionality will actually do the sorting.

    Can we see the code controlling the datasubset? If you manually query your data with the date column sorted does the behavior remain the same?
  • 0
    Certified Senior Developer
    in reply to Mike Schmitt
    I believe I found the issue. The VW that the dataSubset was coming from had the date field improperly defined as a varchar. Even though they were text values, they were being sorted properly by month/day so it wasn't immediately apparent that there was a data type issue
Reply Children