davecotter
2010-05-19 17:47:01 UTC
say i create a list view with column "id"s [0, 1, 2, 3]
now, in my back end, i've created a "map" so that i know that ID 0 maps to
say "track number", 1 maps to "song name", 2 "artist name" and 3 is "album
name". sound good?
now say the user reorders the columns, such that a call to
GetColumnOrderArray() returns [0, 1, 3, 2]
so now my "map" says "track, song name, album name, artist name", right?
cuz now 3 comes before 2. so far so good.
now, what if the user decides to hide the artist name? (that would be ID 2,
which is NOW at index 3!)
so i call DeleteColumn() with INDEX 3 (note: this API does not take the ID,
but the index, or the left-to-right order of visual appearance)
you might think that the array would now be [0, 1, 3], right? no, you'd be
wrong about that. for some reason i am totally unable to fathom, the array
is *renumbered* to [0, 1, 2], so unless i change my map to say "by the way 2
now points to what 3 used to point to", i'm screwed.
what is really going on here? what am i missing? what is the strategy
people usually use?
now, in my back end, i've created a "map" so that i know that ID 0 maps to
say "track number", 1 maps to "song name", 2 "artist name" and 3 is "album
name". sound good?
now say the user reorders the columns, such that a call to
GetColumnOrderArray() returns [0, 1, 3, 2]
so now my "map" says "track, song name, album name, artist name", right?
cuz now 3 comes before 2. so far so good.
now, what if the user decides to hide the artist name? (that would be ID 2,
which is NOW at index 3!)
so i call DeleteColumn() with INDEX 3 (note: this API does not take the ID,
but the index, or the left-to-right order of visual appearance)
you might think that the array would now be [0, 1, 3], right? no, you'd be
wrong about that. for some reason i am totally unable to fathom, the array
is *renumbered* to [0, 1, 2], so unless i change my map to say "by the way 2
now points to what 3 used to point to", i'm screwed.
what is really going on here? what am i missing? what is the strategy
people usually use?