Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

Horizontal movable grid

hi, we are looking at enhancing our Bug Tracking software. To explain, we capture the rank (importance) of the bug in a field, let's call it Rank from 1 to N. The problem being is that if there is a new Number 3, there is no way to move the present #3 down and automatically rerank everything else. For Example:

Bug  Current Rank          New Rank
A              1                        1
B              2                        2
C              3                        3
D              4                        4
E              5                        5

All of a sudden Bug F comes along with a new Rank of 3.
Bug  Current Rank          New Rank
A              1                        1
B              2                        2
F                3                        3
C              3                        4
D              4                        5
E              5                        6

How can I do this? What grid component can I just move things up and down?

Thanks!

AnonForThis
Tuesday, January 18, 2005

One way to deal with this is to allow bigger numbers for the rank, like in the millions:

1,000,000
2,000,000,
..., etc

Then you can easily put new ones in between:

1,000,000
1,500,000,
2,000,000,
..., etc

Eventually, you'll have to re-organise them, but this can be automated and is trivial.

Nemesis
Tuesday, January 18, 2005

i really can't do that. The real question is can i move datarows up and down in a datagrid? Then, i can just base the New Rank off of where it is in the collection.

AnonForThis
Tuesday, January 18, 2005

Assuming you're binding the data grid to an data source, can you change the sequence of the data source?  Stupid question, but sequencing the data before it gets to the grid seems like the best option.

moron
Tuesday, January 18, 2005

I can sequence it before it gets to the datagrid. But, then can i change the order (move up and down) the rows in the datagrid?

AnonForThis
Tuesday, January 18, 2005

You could perform an SQL update thus:

UPDATE bugs set newrank = newrank + 1 where currentrank >= 3

And then refill the dataset and rebind the data.

C O'Connor
Tuesday, January 18, 2005

that will work Connor. Thanks!

AnonForThis
Tuesday, January 18, 2005

*  Recent Topics

*  Fog Creek Home