Page 1 of 1

Problem with datagrid and automatic sorting...

Posted: Mon Apr 01, 2013 8:44 am
by RevDevelopment
Hello,
I have an application that contains a datagrid with 3 columns.

Column 1 is a checkbox
Column 2 is a word
Column 3 is a number

In the application, the user is able to click the checkbox (column 1) and
use a right click menu to delete that row of the datagrid.

Or the user can check multiple checkboxes, and use the right click menu
to "delete all checked rows".

Here is the problem.

Let's say there are 300 rows in the datagrid, and a scrollbar is used to
scroll to the bottom rows of the datagrid.

When the user checks a checkbox after scrolling to the bottom, the entire datagrid then scrolls back
to the top, which keeps the user from checking more than one box at a time
when scrolled down and they are forced to then scroll back down again and check the next box, etc...

I was able to set a breakpoint and find the specific line of code that causes
the datagrid to scroll back to the top when a checkbox is checked.

41 lock screen
42 set the dgData of me to tArray
43 put the dgProp["sort by column"] of group "DataGrid 1" into tSortedColumn
44 send "SortDataGridColumn" && tSortedColumn to group "DataGrid 1"
45 unlock screen

In the above code, as soon as line 42 is executed, the datagrid automatically
scrolls back to the top.

Hope someone has some ideas to test. :)

Thank you!

Re: Problem with datagrid and automatic sorting...

Posted: Mon Apr 01, 2013 3:49 pm
by dunbarx
Hi.

Things may be running normally, in that when you set the dgData to the array contents, the datagrid itself sort of reverts to its "natural" state, which is scrolled to 0.

I think.

Anyway, why not just store the scroll value right before the reload, and rescroll to that value?

Craig Newman

Re: Problem with datagrid and automatic sorting...

Posted: Tue Apr 02, 2013 12:25 pm
by RevDevelopment
Craig,
Thank you for your help on this.

Let me try that and see if it might work. :)

Thanks!

Re: Problem with datagrid and automatic sorting...

Posted: Tue Apr 02, 2013 1:02 pm
by RevDevelopment
Craig,
Thanks for the help...it worked! :mrgreen: