1 function init_picker(selector, ordered) {
2 //console.log("init_picker");
3 //console.log($(selector));
5 var addBtn = $(selector).find(".btn-picker-add");
6 var removeBtn = $(selector).find(".btn-picker-remove");
7 var upBtn = $(selector).find(".btn-picker-up");
8 var downBtn = $(selector).find(".btn-picker-down");
9 var from = $(selector).find(".select-picker-from");
10 var to = $(selector).find(".select-picker-to");
17 addBtn.click(function(){
19 from.find(":selected").each( function() {
20 to.append("<option value='"+$(this).val()+"'>"+$(this).text()+"</option>");
\r
24 removeBtn.click(function(){
\r
25 console.log("remove");
\r
26 to.find(":selected").each( function() {
\r
27 from.append("<option value='"+$(this).val()+"'>"+$(this).text()+"</option>");
\r
31 upBtn.bind('click', function() {
\r
32 to.find(":selected").each( function() {
\r
33 var newPos = to.find('option').index(this) - 1;
\r
35 to.find("option").eq(newPos).before("<option value='"+$(this).val()+"' selected='selected'>"+$(this).text()+"</option>");
\r
40 downBtn.bind('click', function() {
\r
41 var countOptions = to.find("option").size();
\r
42 to.find(":selected").each( function() {
\r
43 var newPos = to.find("option").index(this) + 1;
\r
44 if (newPos < countOptions) {
\r
45 to.find("option").eq(newPos).after("<option value='"+$(this).val()+"' selected='selected'>"+$(this).text()+"</option>");
\r
52 function init_spinner(selector, value) {
\r
53 var spinner = $(selector).spinner( "value", value);
\r