Announcement

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

    Wrong sort-order for grouped listgrid

    Hi,

    we're currently using v10.0p_2014-11-16 and have detected an issue while grouping and sorting multiple entries in a listgrid. The issues exists in tested latest builds of firefox, chrome and IE11.

    We are displaying multiple items and are grouping by a date-field. And the grouped items we want to have sorted from not to the future. By sorting for the date-Field there should be a other sorting beginning with 17.11.2014 to the end 23.11.2014. There seems to be another sorting, like the english sunday, monday ... but this is not defined in the given definition (and not needed for other languages ;-) ).

    For a faster impression i have changed the group-title.


    Code:
    isc.ListGrid.create({
    	"leaveScrollbarGap" : true,
    	"sortField" : "dateField",
    	"sortDirection" : "ascending",
    	"selectionProperty" : "isSelected",
    	"groupByField" : "dateField",
    	"autodraw" : true,
    	"groupStartOpen" : "all",
    	"width" : "100%",
    	"height" : "100%",
    	"fields" :
    	[{
    			"name" : "nameField",
    			"title" : "Name",
    			"type" : "text",
    		}, {
    			"name" : "dateField",
    			"title" : "Date",
    			"type" : "date",
    			"getGroupTitle" : function (groupValue, groupNode, field, fieldName, grid) {
    				return groupNode.groupMembers[0].groupTitle;
    			}
    		},
    	],
    	"data" :
    	[{
    			"dateField" : new Date(2014, 10, 18),
    			"nameField" : "q",
    			"groupTitle" : "18.11.14 - Tuesday"
    		}, {
    			"dateField" : new Date(2014, 10, 23),
    			"nameField" : "q",
    			"groupTitle" : "23.11.14 - Sunday"
    		}, {
    			"dateField" : new Date(2014, 10, 20),
    			"nameField" : "q",
    			"groupTitle" : "20.11.14 - Thursday"
    		}, {
    			"dateField" : new Date(2014, 10, 17),
    			"nameField" : "q",
    			"groupTitle" : "17.11.14 - Monday"
    		}, {
    			"dateField" : new Date(2014, 10, 22),
    			"nameField" : "q",
    			"groupTitle" : "22.11.14 - Saturday"
    		}, {
    			"dateField" : new Date(2014, 10, 19),
    			"nameField" : "q",
    			"groupTitle" : "19.11.14 - Wednesday"
    		}, {
    			"dateField" : new Date(2014, 10, 21),
    			"nameField" : "q",
    			"groupTitle" : "21.11.14 - Friday"
    		}
    	]
    })
    thaks in advance

    #2
    we want to have sorted from not to the future
    Please try again to explain what you want.

    Comment


      #3
      sorry for the typo.

      we want the listgrid sorted and grouped by date
      17.11.2014 at the top
      23.11.2014 at the bottom.

      i think in the definition of the listgrid it's correct defined, but it seems the sorting is doing something wrong.

      Comment


        #4
        By default, Dates group by Day of the Week, so that's why you see them ordered like that, independent of which Date is actually first chronologically. Assuming you want to group by Epoch Day (so that two entries are only grouped together if they fall on the same real day), then you could add something like this below your definition of getGroupTitle():

        Code:
        "getGroupValue" : function (value) {
        return Math.floor(value.getTime()/86400000)
        }
        See http://www.smartclient.com/docs/10.0....getGroupValue.
        Last edited by Isomorphic; 19 Nov 2014, 16:52.

        Comment


          #5
          ok grouping dated for weekday makes sense. getGroupValue is indeed the solution to our problem.

          btw: if you're using another locale (for example german) where the first day of week is monday, the order seems to be wrong. Maybe it's hard-coded that the week starts on sunday and the first day is not taken from the locale?

          Comment


            #6
            We're looking into both of these issues - we'll update here when we have more information

            Comment


              #7
              We've fixed the original issue you reported - group order when sorting and grouping on a date field - and a couple of other edge cases.

              You can access the fix in builds dated November 26 and later.

              Comment

              Working...
              X