datagrid sorting
Posted: Mon Oct 03, 2011 1:05 pm
Apologies if this already has a solution or has been posted elsewhere...
In datagrid sorting, one can already set up sort types as alphabetic or numeric, and one can choose between ascending and descending. However, it would be nice if there was a flag that could specify how null values are to be dealt with. That is, is a null value to be sorted as though it is less than 0 say, or infinity. Alphabetically, a null could be specified as coming before A or after Z.
This issue has a visual impact on tables. If I have a column with alphabetic entries in it, and a bunch of nulls, then an ascending sort lists the null entries first and then the populated entries. That makes the top of the column blank and pushes all the real values to the bottom. Not too friendly that. A descending sort of course starts the column with the Z entries, but I suspect a user (well, me anyway) would prefer the ascending sort to list the A,B,C first, followed by blanks, and a descending to switch the Z,Y,X. The latter happens now, the former doesn't.
A work around is to trap the entries with a default column behaviour perhaps - replace nulls with some character that comes after Z for an ascending sort. The column ascending sort would then list A,B,C, etc, and the nulls go to the bottom of the column, where they are trapped and replaced with nulls again.
However, although there is a work around, it would be much nicer if there was a :
set the dgColumnSortNull [COLUMN] to "first" or "last"
which specifies where nulls come in an ascending sort.
Unless I'm missing something ????
In datagrid sorting, one can already set up sort types as alphabetic or numeric, and one can choose between ascending and descending. However, it would be nice if there was a flag that could specify how null values are to be dealt with. That is, is a null value to be sorted as though it is less than 0 say, or infinity. Alphabetically, a null could be specified as coming before A or after Z.
This issue has a visual impact on tables. If I have a column with alphabetic entries in it, and a bunch of nulls, then an ascending sort lists the null entries first and then the populated entries. That makes the top of the column blank and pushes all the real values to the bottom. Not too friendly that. A descending sort of course starts the column with the Z entries, but I suspect a user (well, me anyway) would prefer the ascending sort to list the A,B,C first, followed by blanks, and a descending to switch the Z,Y,X. The latter happens now, the former doesn't.
A work around is to trap the entries with a default column behaviour perhaps - replace nulls with some character that comes after Z for an ascending sort. The column ascending sort would then list A,B,C, etc, and the nulls go to the bottom of the column, where they are trapped and replaced with nulls again.
However, although there is a work around, it would be much nicer if there was a :
set the dgColumnSortNull [COLUMN] to "first" or "last"
which specifies where nulls come in an ascending sort.
Unless I'm missing something ????