:multiple => true, :size => 10, :style => "width:150px" %>
</td>
<td align="center" valign="middle">
- <input type="button" value="-->"
+ <input type="button" value="→"
onclick="moveOptions(this.form.available_columns, this.form.selected_columns);" /><br />
- <input type="button" value="<--"
+ <input type="button" value="←"
onclick="moveOptions(this.form.selected_columns, this.form.available_columns);" />
</td>
<td><%= select_tag 'query[column_names][]',
options_for_select(query.columns.collect {|column| [column.caption, column.name]}),
:id => 'selected_columns', :multiple => true, :size => 10, :style => "width:150px" %>
</td>
+ <td align="center" valign="middle">
+ <input type="button" value="↑" onclick="moveOptionUp(this.form.selected_columns);" /><br />
+ <input type="button" value="↓" onclick="moveOptionDown(this.form.selected_columns);" />
+ </td>
</tr>
</table>
theSel.options[selLength] = newOpt;\r
}\r
\r
+function swapOptions(theSel, index1, index2)\r
+{\r
+ var text, value;\r
+ text = theSel.options[index1].text;\r
+ value = theSel.options[index1].value;\r
+ theSel.options[index1].text = theSel.options[index2].text;\r
+ theSel.options[index1].value = theSel.options[index2].value;\r
+ theSel.options[index2].text = text;\r
+ theSel.options[index2].value = value;\r
+}\r
+\r
function deleteOption(theSel, theIndex)\r
{ \r
var selLength = theSel.length;\r
if(NS4) history.go(0);\r
}\r
\r
+function moveOptionUp(theSel) {\r
+ var index = theSel.selectedIndex;\r
+ if (index > 0) {\r
+ swapOptions(theSel, index-1, index);\r
+ theSel.selectedIndex = index-1;\r
+ }\r
+}\r
+\r
+function moveOptionDown(theSel) {\r
+ var index = theSel.selectedIndex;\r
+ if (index < theSel.length - 1) {\r
+ swapOptions(theSel, index, index+1);\r
+ theSel.selectedIndex = index+1;\r
+ }\r
+}\r
+\r
function selectAllOptions(id)\r
{\r
var select = $(id);\r