Hi
I think I have encountered a bug in the WebGrid control.
I have created a datasource which connects to the NWind db and returns all data from the "Alphabetical List of Products" view. I have initialised a WebGrid control with this datasource.
For my purposes, I need to cause a postback when I sort any of the columns. Therefore, I connect an empty method to the SortColumn event.
If I drag and drop a couple of columns into the Group By box, the control groups the columns correctly.
However, when I sort any of the columns (either a grouped or ungrouped column), the column groupings shift (or rotate) left and continue to do so whenever I click any column header.
The behaviour does not occur if there is no postback.
Please assist.
Andy
Andrew,
I'm checking with our developers to see if we have an ETA that we can provide for your development issue. It's still under research. Once I have this information, I'll provide it to you through the support case you submitted.
Vince
The workaround I provided does not work in all circumstances.
I submitted a support request three weeks ago and it is still in review state. I have received no feedback without having to request a status update. Your support/development team are yet to provide me with a timeframe for a fix.
We are a priority support customer. At the moment we are wondering why.
This problem is preventing the progress of our project. If it is not resolved within the week we will be looking to use another provider.
Andrew Murphy
Thanks for posting your workaround. If other people encounter this issue, the workaround may be helpful for them until we figure out what the underlying cause is.
Thanks Vince.
Looks like it is a bug. I have submitted a support request and it has been set as a development task.
In the mean time, I have a workaround:
{
// re-sort column groups
List<SortIndicator> groupedColSortIndicators = new List<SortIndicator>();
groupedColIndices.Add(col.Index);
groupedColSortIndicators.Add(col.SortIndicator);
}
UltraWebGrid1.Columns[groupedColIndices[i]].SortIndicator = groupedColSortIndicators[i];
This doesn't sound like correct behavior to me. If your SortColumn event handler is empty, that shouldn't be impacting the results.
There's another way to force a postback to occur when sorting the grid. If you set the grid's DisplayLayout.AllowSorting to "Yes", then a postback should be generated when you try to sort on a column (as opposed to setting it to "OnClient").
If you can reproduce this in a sample project, then I suggest that you submit a support request so that a Developer Support Engineer can investigate this more in-depth.