[SOLVED] Datagridview column order not staying static

Answered Closed
0
0

I am currently learning the differences from Visual Webgui to Wisej. One of my projects uses a large grid with approximately 60 columns. I created a very simple dataset with fields that would be used in the real application. I set the datasource of the grid to the dataset, no problem. The fun started when I created possibly more columns than the visible design surface. I expanded the grid in design view to accommodate. When I ran the application, the order of the columns changed to the design. I could then close the application and inspect the order of the columns, and no change. Is there a method to ensure columns are locked according to the original design.

  • You must to post comments
Best Answer
0
0

Hi John,

the bug number is WJ-7748 and a fix will be in the new release, published tomorrow.

Thanks
Frank

  • You must to post comments
0
0

Yep, the problem is the sorting by display index. When it’s  all -1 (the default), the order is scrambled since we use List<>.Sort() which uses quick sort which is an “unstable” sort  and items with identical values are not guaranteed to keep their order. My guess is that below a certain number quick sort is stable.

Anyway, it’s fixed in  the upcoming update.

Thanks,

Luca

 

  • John Sainsbury
    Thanks for that, I look forward to the next update. Hopefully it will not be too far away.
  • You must to post comments
0
0

After further investigation, if you have more than 16 columns, the order is mixed up. Remove columns and have no more than 16 and the order will stay correct.

  • You must to post comments
0
0

I just noticed the sample I sent saved the columns in the changed order. The correct order should be idcode, jobid, lastname, firstname, trade, mobile, airport etc. If you use the designer to change the order, it will revert back to a different order. This behavior only occurs once you have more columns than the visible grid.

  • You must to post comments
Showing 4 results