Any Slick Way to Implement Item Order

  • Thread starter Thread starter Jonathan Wood
  • Start date Start date
J

Jonathan Wood

I have a requirement to provide users with the ability to control the order
of items in a table, used by an ASP.NET application.

Requiring them to enter a number into a new column, which I would then sort
by, is not a valid option as it becomes too messy when they are adding,
deleting, or changing the order of items. Ideally, I would have an UP/DOWN
button for each item, and items would order as created but could then be
moved around using these buttons.

Does anyone have suggestions on an efficient way to implement this? I would
really like to minimize the number of database hits in implementing this.
For example, when writing a new item, I could do a query to return the
highest order value so far and store the new item with a value one higher.
And then when swapping the order of two items, I'd have to read both rows,
and then write both rows. I'd love to improve on the efficiency of this. I
don't suppose SQL has some sort of command to swap the column values of two
different rows.

Thanks!
 
Jonathan,

Do you mean that you need to control the order of rows in a physical table
in a relational database?

Or do you mean that you need to control the order that the rows are
displayed to the user?

Kerry Moorman
 
It doesn't not matter how it is implemented. As long as the user can control
the order that the items appear.

I know that it is not practical to control the order of rows in a physical
table. I need to control the order that rows are displayed. The tricky part
is an efficient UI that allows the user to control this.
 
Johathan,

How would the users control that, by making a connection to their brains.

Sorry, but that is probably like Kerry my confusion with your message.

Cor
 
Cor,
How would the users control that, by making a connection to their brains.

A lot of your replies sure seem abrasive. I really don't understand why you
feel the need to make comments like that.

Having been a desktop programmer for about 25 years, I could come up with a
million different ways. Basically, I would default to the order in which the
items were initially added. And then perhaps add up and down buttons on each
row that swap that row with the previous or next row.

???
 
Jonathan,

My reply was as it was, only to show that it was at least for me in both of
your messages not understandable what you wanted to do.

The first one was this.
snip............
would have an UP/DOWN button for each item, and items would order as
created but could then be moved around using these buttons.

Where he though does he want a navigation part on every item on the screen
(cross navigation control).

The answer to Kerry did make it not better.

Now I understand what you mean, but have because of the way you replied, not
the idea that I am the one who should give you an answer.

Cor
 
William Vaughn,
Have you considered a UI that the user might already be familiar with?
For example, Excel, or Word (tables) where the user can select,drag and
drop items? This would require less training. Implementation would be a
matter of managing the DataTable Rows collection and drag-and-drop events.
That is, the user would select a row to reposition in a DataGridView, your
UI event handler would highlight the row (changing DataGridView cell/row
properties) and when the selection was dropped, you would reorg the Rows
collection and refresh the DataSource to rebind.

Someone else suggested this too. On the negative side, my users are not
generally computer users and there's a possibility they could be confused by
drag and drop. On the positive side, there would only be one database hit to
shift an item several rows. Of course, the bigger issue would be
implementation. I haven't seen anything like this and probably couldn't
justify doing it from scratch.

Thanks.

Jonathan

____________________________________________________________________________________________> "Jonathan Wood" <[email protected]> wrote in messageIt doesn't not matter how it is implemented. As long as the user cancontrol the order that the items appear.>>>> I know that it is not practical to control the order of rows in aphysical table. I need to control the order that rows are displayed. Thetricky part is an efficient UI that allows the user to control this.>>>> -->> Jonathan Wood>>>>>> "Kerry Moorman" <[email protected]> wrote in messageJonathan,>>>>>> Do you mean that you need to control the order of rows in a physicaltable>>> in a relational database?>>>>>> Or do you mean that you need to control the order that the rows are>>> displayed to the user?>>>>>> Kerry Moorman>>>>>>>>> "Jonathan Wood" wrote:>>>>>>> I have a requirement to provide users with the ability to control theorder>>>> of items in a table, used by an ASP.NET application.>>>>>>>> Requiring them to enter a number into a new column, which I would thensort>>>> by, is not a valid option as it becomes too messy when they are adding,>>>> deleting, or changing the order of items. Ideally, I would have anUP/DOWN>>>> button for each item, and items would order as created but could thenbe>>>> moved around using these buttons.>>>>>>>> Does anyone have suggestions on an efficient way to implement this? Iwould>>>> really like to minimize the number of database hits in implementingthis.>>>> For example, when writing a new item, I could do a query to return the>>>> highest order value so far and store the new item with a value onehigher.>>>> And then when swapping the order of two items, I'd have to read bothrows,>>>> and then write both rows. I'd love to improve on the efficiency ofthis. I>>>> don't suppose SQL has some sort of command to swap the column values oftwo>>>> different rows.>>>>>>>> Thanks!>>>>>>>> -->>>> Jonathan Wood>>>
 
¤ I have a requirement to provide users with the ability to control the order
¤ of items in a table, used by an ASP.NET application.
¤
¤ Requiring them to enter a number into a new column, which I would then sort
¤ by, is not a valid option as it becomes too messy when they are adding,
¤ deleting, or changing the order of items. Ideally, I would have an UP/DOWN
¤ button for each item, and items would order as created but could then be
¤ moved around using these buttons.
¤
¤ Does anyone have suggestions on an efficient way to implement this? I would
¤ really like to minimize the number of database hits in implementing this.
¤ For example, when writing a new item, I could do a query to return the
¤ highest order value so far and store the new item with a value one higher.
¤ And then when swapping the order of two items, I'd have to read both rows,
¤ and then write both rows. I'd love to improve on the efficiency of this. I
¤ don't suppose SQL has some sort of command to swap the column values of two
¤ different rows.

Hi Jonathan,

I think Patrice has you on the right track. Probably an AJAX control or Javascript solution would
work well since you definitely want client-side or the appearance of client-side execution to occur.
Take a look at the following as well:

http://www.code-magazine.com/article.aspx?quickid=0605041&page=1


Paul
~~~~
Microsoft MVP (Visual Basic)
 
I don't know if i understood your complete problem. but from whatever i
could, can't you use a view and use Sort property. can persist the last
sorted column and order in viewstate.
I have a requirement to provide users with the ability to control the
order of items in a table, used by an ASP.NET application.
Requiring them to enter a number into a new column, which I would then
sort by, is not a valid option as it becomes too messy when they are
adding, deleting, or changing the order of items. Ideally, I would have
an UP/DOWN button for each item, and items would order as created but
could then be moved around using these buttons.
Does anyone have suggestions on an efficient way to implement this? I
would really like to minimize the number of database hits in implementing
this. For example, when writing a new item, I could do a query to return
the highest order value so far and store the new item with a value one
higher. And then when swapping the order of two items, I'd have to read
both rows, and then write both rows. I'd love to improve on the
efficiency of this. I don't suppose SQL has some sort of command to swap
the column values of two different rows.
 
I haven't used a View with a Sort property, but I don't see how it could
ever be sorted without a field to sort by. It is the efficent implementation
and maintenance of this sort field that becomes the issue.

Thanks.

Jonathan

wrote in message news:%[email protected]...
 
Back
Top