@@ -5,15 +5,19 | |||||
5 | :multiple => true, :size => 10, :style => "width:150px" %> |
|
5 | :multiple => true, :size => 10, :style => "width:150px" %> | |
6 | </td> |
|
6 | </td> | |
7 | <td align="center" valign="middle"> |
|
7 | <td align="center" valign="middle"> | |
8 |
<input type="button" value=" |
|
8 | <input type="button" value="→" | |
9 | onclick="moveOptions(this.form.available_columns, this.form.selected_columns);" /><br /> |
|
9 | onclick="moveOptions(this.form.available_columns, this.form.selected_columns);" /><br /> | |
10 |
<input type="button" value="& |
|
10 | <input type="button" value="←" | |
11 | onclick="moveOptions(this.form.selected_columns, this.form.available_columns);" /> |
|
11 | onclick="moveOptions(this.form.selected_columns, this.form.available_columns);" /> | |
12 | </td> |
|
12 | </td> | |
13 | <td><%= select_tag 'query[column_names][]', |
|
13 | <td><%= select_tag 'query[column_names][]', | |
14 | options_for_select(query.columns.collect {|column| [column.caption, column.name]}), |
|
14 | options_for_select(query.columns.collect {|column| [column.caption, column.name]}), | |
15 | :id => 'selected_columns', :multiple => true, :size => 10, :style => "width:150px" %> |
|
15 | :id => 'selected_columns', :multiple => true, :size => 10, :style => "width:150px" %> | |
16 | </td> |
|
16 | </td> | |
|
17 | <td align="center" valign="middle"> | |||
|
18 | <input type="button" value="↑" onclick="moveOptionUp(this.form.selected_columns);" /><br /> | |||
|
19 | <input type="button" value="↓" onclick="moveOptionDown(this.form.selected_columns);" /> | |||
|
20 | </td> | |||
17 | </tr> |
|
21 | </tr> | |
18 | </table> |
|
22 | </table> | |
19 |
|
23 |
@@ -7,6 +7,17 function addOption(theSel, theText, theValue) | |||||
7 | theSel.options[selLength] = newOpt; |
|
7 | theSel.options[selLength] = newOpt; | |
8 | } |
|
8 | } | |
9 |
|
9 | |||
|
10 | function swapOptions(theSel, index1, index2) | |||
|
11 | { | |||
|
12 | var text, value; | |||
|
13 | text = theSel.options[index1].text; | |||
|
14 | value = theSel.options[index1].value; | |||
|
15 | theSel.options[index1].text = theSel.options[index2].text; | |||
|
16 | theSel.options[index1].value = theSel.options[index2].value; | |||
|
17 | theSel.options[index2].text = text; | |||
|
18 | theSel.options[index2].value = value; | |||
|
19 | } | |||
|
20 | ||||
10 | function deleteOption(theSel, theIndex) |
|
21 | function deleteOption(theSel, theIndex) | |
11 | { |
|
22 | { | |
12 | var selLength = theSel.length; |
|
23 | var selLength = theSel.length; | |
@@ -45,6 +56,22 function moveOptions(theSelFrom, theSelTo) | |||||
45 | if(NS4) history.go(0); |
|
56 | if(NS4) history.go(0); | |
46 | } |
|
57 | } | |
47 |
|
58 | |||
|
59 | function moveOptionUp(theSel) { | |||
|
60 | var index = theSel.selectedIndex; | |||
|
61 | if (index > 0) { | |||
|
62 | swapOptions(theSel, index-1, index); | |||
|
63 | theSel.selectedIndex = index-1; | |||
|
64 | } | |||
|
65 | } | |||
|
66 | ||||
|
67 | function moveOptionDown(theSel) { | |||
|
68 | var index = theSel.selectedIndex; | |||
|
69 | if (index < theSel.length - 1) { | |||
|
70 | swapOptions(theSel, index, index+1); | |||
|
71 | theSel.selectedIndex = index+1; | |||
|
72 | } | |||
|
73 | } | |||
|
74 | ||||
48 | function selectAllOptions(id) |
|
75 | function selectAllOptions(id) | |
49 | { |
|
76 | { | |
50 | var select = $(id); |
|
77 | var select = $(id); |
General Comments 0
You need to be logged in to leave comments.
Login now