如何从客户端重新排序下拉列表控件,如NetFlix队列(Javascript)

时间:2021-08-21 07:23:26

We have a series of drop down controls that determine the sort order of columns. The problem we are having is when the user selects a column as the 2nd column the other dropdown lists need to have their values changed so that there is only one "2nd".

我们有一系列下拉控件来确定列的排序顺序。我们遇到的问题是当用户选择一列作为第二列时,其他下拉列表需要更改其值,以便只有一个“第二”。

  1. Column A [1]
  2. A栏[1]

  3. Column B [2]
  4. B栏[2]

  5. Column C [3]
  6. C栏[3]

  7. Column D [4]
  8. D栏[4]

  9. Column E [5]
  10. E栏[5]

In the list above, when you change Column D to [2], Column B becomes [3], C becomes [4], etc. I can manage it on the server side but I was wondering if anybody had some clues how to do this on the client side with javascript.

在上面的列表中,当您将D列更改为[2]时,B列变为[3],C变为[4]等。我可以在服务器端管理它,但我想知道是否有人有一些线索怎么办这在客户端使用javascript。

2 个解决方案

#1


2  

Look at Javascript toolkits like Scriptaculous for client side reordering.

查看像Scriptaculous这样的Javascript工具包,用于客户端重新排序。

You add your elements as "Sortables" and code your own callbacks to execute when the items are dragged, then dropped -- such as sending an asynchronous request to the server to persist the new order.

您将元素添加为“可排序”并编码自己的回调以在拖动项目时执行,然后删除 - 例如向服务器发送异步请求以保留新订单。

Here is a full tutorial on creating sortable lists with Scriptaculous and PHP. For ASP, the client side code will be slightly different, but the process will be similar.

这是一个关于使用Scriptaculous和PHP创建可排序列表的完整教程。对于ASP,客户端代码会略有不同,但过程将类似。

#2


0  

On a note on JavaScript frameworks; I highly recommend jQuery.

关于JavaScript框架的说明;我强烈推荐jQuery。

#1


2  

Look at Javascript toolkits like Scriptaculous for client side reordering.

查看像Scriptaculous这样的Javascript工具包,用于客户端重新排序。

You add your elements as "Sortables" and code your own callbacks to execute when the items are dragged, then dropped -- such as sending an asynchronous request to the server to persist the new order.

您将元素添加为“可排序”并编码自己的回调以在拖动项目时执行,然后删除 - 例如向服务器发送异步请求以保留新订单。

Here is a full tutorial on creating sortable lists with Scriptaculous and PHP. For ASP, the client side code will be slightly different, but the process will be similar.

这是一个关于使用Scriptaculous和PHP创建可排序列表的完整教程。对于ASP,客户端代码会略有不同,但过程将类似。

#2


0  

On a note on JavaScript frameworks; I highly recommend jQuery.

关于JavaScript框架的说明;我强烈推荐jQuery。