SOLVED ds_grid_sort functionality has changed?? HALP

despair3042

Member
So let's say here we have a 1x10 ds_grid, holds the following values: 20,10,1,2,3,4
Back in GMS 2.2, when you perform a ds_grid_sort(myGrid, 0, ture), would result the following: 1,2,3,4,10,20

BUT in GMS 2.3.1, using the exactly same code and grid, the result would be: 1,10,2,20,3,4

I mean wtf. this drove me insane when i trying to find out whats going on after i migrate my 2.2 project to 2.3.
Does anyone know how to change the sorting method back? :( thanks alot.
 

Umaro

Member
Just tested it and it works fine for me. Are you sorting strings instead of numbers by any chance?
 

PlayerOne

Member
So let's say here we have a 1x10 ds_grid, holds the following values: 20,10,1,2,3,4
Back in GMS 2.2, when you perform a ds_grid_sort(myGrid, 0, ture), would result the following: 1,2,3,4,10,20

BUT in GMS 2.3.1, using the exactly same code and grid, the result would be: 1,10,2,20,3,4

I mean wtf. this drove me insane when i trying to find out whats going on after i migrate my 2.2 project to 2.3.
Does anyone know how to change the sorting method back? :( thanks alot.
I can confirm that this indeed the case regardless if they are numbers or strings ( I used the exact numbers as stated above). Although I've never used grid sorting before so I can't confirm before the 2.3 update if thats's true or not.
 

PlayerOne

Member
Perhaps having a grid with both strings and integers causes the hintst he cast to strings in order for the sportingt make sense.

What happens if you use two separate grids, one with just integers, the other with just strings?
I've never used grid sorting before so forgive me. Based on separating the groups only the strings are going in 1,10,2,20,3,4 and numbers go in 1,2,3,4,10,20.

You learn something new.
 
Last edited:

chamaeleon

Member
@PlayerOne Unless I'm missing something, given you call sort twice on the same grid, the second call will make the first call irrelevant. I'm not really sure what you were trying to show there, beside that strings sort as strings, not by numeric value. You do know that doing a grid sort with a given column will rearrange all the columns so the rows stay consistent, not just the column you said to sort by, right?
 

GMWolf

aka fel666
@PlayerOne Unless I'm missing something, given you call sort twice on the same grid, the second call will make the first call irrelevant. I'm not really sure what you were trying to show there, beside that strings sort as strings, not by numeric value. You do know that doing a grid sort with a given column will rearrange all the columns so the rows stay consistent, not just the column you said to sort by, right?
ah that makes sense! once again reading the manual helps haha
 
Top