Class jsbeans.Select
A javascript Object with both static and instance methods
Constructor
jsbeans.Select
(
[id]
)
- Parameters:
-
[id]
<String>
if provided it stores the Select Object for future use.
Methods
static
void
copy
(
source
,
destination
,
[options]
)
Copy selected Options from {@param} source
to {@param} destination
.
- Parameters:
-
source
<String | DOM>
the Select Object (or its id
)
-
destination
<String | DOM>
the Select Object (or its id
)
-
[options]
<JSON>
order: boolean, // order both destination by text. Optional, default false.
orderDestination: boolean, // order only destination by text.
- Returns:
void
static
void
copyAll
(
source
,
destination
,
[options]
)
Copy selected Options from {@param} source
to {@param} destination
.
- Parameters:
-
source
<String | DOM>
the Select Object (or its id
)
-
destination
<String | DOM>
the Select Object (or its id
)
-
[options]
<JSON>
order: boolean, // order destination by text. Optional, default false.
orderDestination: boolean, // order only destination by text.
- Returns:
void
static
void
filter
(
value
,
select
)
Shows only Options of {@param} select
whose text contains string {@param} value
.
- Parameters:
-
value
<String>
-
select
<String | DOM>
the Select Object (or its id
)
- Returns:
void
static
void
filterObjectCleaner
(
)
As {@method} filter
creates hidden selects, developer can purge all created ones calling this.
Please note that selects currently filtered may NOT be restored! Developer may need to clean filter's input before calling this;
jQuery sample: $("#filterInput").val("").keyup();
jsbeans.Select.filterObjectCleaner();
static
Option
min
(
select
)
Returns the lowest Options among {@param} select
's Options by text using <
operator.
- Parameters:
-
select
<String | DOM>
the Select Object (or its id
)
- Returns:
Option
- object
static
void
move
(
source
,
destination
,
[options]
)
Copy selected Options from {@param} source
to {@param} destination
removing them from {@param} source
.
- Parameters:
-
source
<String | DOM>
the Select Object (or its id
)
-
destination
<String | DOM>
the Select Object (or its id
)
-
[options]
<JSON>
order: boolean, // order both source and destination by text. Optional, default false.
orderSource: boolean, // order only source by text.
orderDestination: boolean, // order only destination by text.
- Returns:
void
static
void
moveAll
(
source
,
destination
,
[options]
)
Copy all Options from {@param} source
to {@param} destination
removing them from {@param} source
.
- Parameters:
-
source
<String | DOM>
the Select Object (or its id
)
-
destination
<String | DOM>
the Select Object (or its id
)
-
[options]
<JSON>
order: boolean, // order destination by text. Optional, default false.
orderDestination: boolean, // order only destination by text.
- Returns:
void
static
void
order
(
[caseSensitive]
)
Orders Select's Options by their text, not by value.
It calls the static method
- Parameters:
-
[caseSensitive]
<boolean>
optional, false
- Returns:
void
static
void
removeSelected
(
object
)
Useful primarly in multiple selects, a way to delete Options.
- Parameters:
-
object
<String | DOM>
the Select Object or its id
- Returns:
void
void
setDependant
(
childId
,
[parentId]
)
Filters Options of a second Select based on value of the selected option pf the first.
Second options are mapped using style class. See
jsbeans.Select page for details and running sample.
- Parameters:
-
childId
<String>
-
[parentId]
<String>
- Returns:
void