A
Abelardo Vacca
Hello,
I have a DataGrid with columns build dynamically, the grid supports sorting.
I create the columns OnInit so the sort event will fire when the headers are
clicked.
All this works fine.
Now, one requirement is for the user to have the option of selecting
predefined layouts for the DataGrid (differents columns in difference order)
.... I added this feature using a dropdown list control with the layouts names
on top of the page ...
The problem is, since I am creating the DataGrid columns OnInit, the
"selected layout" is NOT available yet (since the dropdown list control
SelectedItemChanged event has not been handled yet ... it can't be handled
before OnInit)
The only way to create the correct columns for the DataGrid would be to
create them after OnInit, but that way I won't have a DataGrid responsive to
sorting events.
Enter Catch-22.
I even tried creating ALL possible columns during OnInit, and later on
deleting the columns and recreating the correct ones (after learing the
"selected layout"), but this creates a really weird behavior when sorting the
columns - clicking one columns could result in sorting another columns -
Any ideas? Could anyone confirm if I am correct by creating the DataGrid
Columns OnInit, or is there any other way of creating these columns without
losing the events?
Thanks
I have a DataGrid with columns build dynamically, the grid supports sorting.
I create the columns OnInit so the sort event will fire when the headers are
clicked.
All this works fine.
Now, one requirement is for the user to have the option of selecting
predefined layouts for the DataGrid (differents columns in difference order)
.... I added this feature using a dropdown list control with the layouts names
on top of the page ...
The problem is, since I am creating the DataGrid columns OnInit, the
"selected layout" is NOT available yet (since the dropdown list control
SelectedItemChanged event has not been handled yet ... it can't be handled
before OnInit)
The only way to create the correct columns for the DataGrid would be to
create them after OnInit, but that way I won't have a DataGrid responsive to
sorting events.
Enter Catch-22.
I even tried creating ALL possible columns during OnInit, and later on
deleting the columns and recreating the correct ones (after learing the
"selected layout"), but this creates a really weird behavior when sorting the
columns - clicking one columns could result in sorting another columns -
Any ideas? Could anyone confirm if I am correct by creating the DataGrid
Columns OnInit, or is there any other way of creating these columns without
losing the events?
Thanks