Initiate a basic input with multiple options
Name | Format | Description | Example |
---|---|---|---|
width | String | Set width for the list |
|
height | String | Set height for the list |
|
autoOpen | Bool | The list would / would not open when the input is focused |
|
headShow | Bool | Set whether showing the list head |
|
fields | Array | Set fields for the list |
|
fieldValue | String | Set the field which would be passed to the input value |
|
fieldText | String | Set the field which would be shown on the screen |
|
highlightResult | Bool | Highlight for the options including the keyword |
|
responsive | Bool | Responsive support |
|
creatable(deprecated)
Please use the following "selectMode:'creatable'" option to replace this option |
Bool | Support inputing value manually |
|
selectMode | String | The input value depends on keyword and the selectMode |
|
Name | Format | Description | Example |
---|---|---|---|
data | Array | Set data for the list |
|
element | var | Get the element object |
|
data_highlighted | var | Get the highlighted element object |
|
value_highlighted | var | Get the highlighted element value |
|
Name | Format | Description | Example |
---|---|---|---|
url | String | Set remote data source for the list |
|
urlParam | Object | Set specific parameters of url for reading remote data |
|
urlHeaders | Object | Set specific headers for reading remote data |
|
urlDelay | Int | Set seconds of delaying to read remote data |
|
Name | Format | Description | Example |
---|---|---|---|
pagination | Bool | Set "true" to open the pagination feature |
|
pageMode | String | Unuse, will use it later | |
pageField | String | Set the field name posting the request url to the server |
|
pageCurrent | Int | Set the current page |
|
pageLimitField | String | Set the limit field name posting the request url to the server |
|
limit | Int | Set the default limit number per page getting from the server |
|
Return JSON:
{"msg":"","count":75,"data":[{"id":2,"region_id":1,"name":"Auckland","hasc":"AL","region_name":"Auckland"},...]} msg: "" // Return error msg count: 75 // The total amount of items data: // The items of current page |
Name | Format | Description | Example |
---|---|---|---|
filterOpen | Bool | Set whether filter list when inputting the content |
|
filterType | String | Set the filter type when filterOpen is true |
|
filterField | String / Array | Set the filter type when filterOpen is true |
|
Name | Format | Description | Example |
---|---|---|---|
multiple | Bool | Set whether supporting multiple values |
|
delimiter | String | Set the delimiter when "multiple" is true |
|
Name | Format | Description | Example |
---|---|---|---|
destroy | - | Restore the input to original if you do not want |
|
The list of Events handlers
Name | Description | Example |
---|---|---|
focus(e) | Focus on the input |
|
change(e) | Activate after updating of the input |
|
change_highlight.inputpicker(e) | Activate after changing highlight option in the dropbox |
|
When using the Inputpicker plugin, it clones the original object to a new object
<input name="original" type="text" />
<input name="original" type="hidden" class="inputpicker-original inputpicker-original-5" data-inputpicker-uuid="5" />
<div id="inputpicker-div-5" class="inputpicker-div">
<input id="inputpicker-5" name="inputpicker-5" class="inputpicker-input" data-inputpicker-uuid="5" data-inputpicker-settings="{json}" data-inputpicker-data={json} />
<span class="inputpicker-arrow" data-inputpicker-uuid="5"><b></b></span>
</div>
<div id="inputpicker-wrapped-list" style="position:absolute;" data-inputpicker-uuid="5">
<table class="table">
<thead>
<tr><th></th></tr>
</thead>
<tbody>
<tr class="inputpicker-wrapped-element inputpicker-wrapped-element-{i}" data-i="0">...</tr>
<tr class="inputpicker-wrapped-element selected" data-i="1">...</tr>
</tbody>
</table>
</div>
You can customise style by your requirements
/**
* jQuery-inputpicker - A jQuery input picker plugin. It supports showing multiple columns select in input.
* Copyright (c) 2017 Ukalpa@gmail.com - https://ukalpa.com/inputpicker
* License: MIT
*/
.inputpicker-div {
position: relative;
/*display: inline-block;*/
overflow: hidden;
height: 100%;
}
.inputpicker-arrow {
position: absolute;
top: 1px;
right: 1px;
width: 20px;
height: 20px;
cursor:pointer;
}
.inputpicker-arrow b {
border-color:#888 transparent transparent;
border-style: solid;
border-width: 5px 4px 0;
height: 0;
left: 50%;
top: 50%;
margin-left: -4px;
margin-top: -2px;
position: absolute;
width: 0;
font-weight: 700;
}
.inputpicker-wrapped-list {
margin:0;
background-color:#ffffff;
z-index: 10000;
}
.inputpicker-wrapped-list {
overflow-y: auto;
}
.inputpicker-wrapped-list .table {
margin-bottom: 0px;
border:1px solid #cccccc;
}
.inputpicker-wrapped-list .table>tbody>tr>td, .inputpicker-wrapped-list .table>tbody>tr>th, .inputpicker-wrapped-list .table>tfoot>tr>td, .inputpicker-wrapped-list .table>tfoot>tr>th, .inputpicker-wrapped-list .table>thead>tr>td, .inputpicker-wrapped-list .table>thead>tr>th {
padding: 5px;
line-height: 1.42857143;
vertical-align: top;
border-top: 1px solid #ddd;
}
.inputpicker-wrapped-list .inputpicker-selected{
background-color: #d9edf7;
}
.inputpicker-wrapped-list .inputpicker-active{
background-color: #248cb5 !important;
}
.inputpicker-wrapped-list .inputpicker-highlight-active{
background-color: #bddef9
}
/*.loading*/
.inputpicker-div input{
display: inline-block;
}
.inputpicker-div input.loading {
background-image: url('data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJzdmctc3Bpbm5lciIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHZpZXdCb3g9IjAgMCA4MCA4MCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggaWQ9InNwaW5uZXIiIGZpbGw9IiM2NjY2NjYiIGQ9Ik00MCw3MkMyMi40LDcyLDgsNTcuNiw4LDQwQzgsMjIuNCwyMi40LDgsNDAsOGMxNy42LDAsMzIsMTQuNCwzMiwzMmMwLDEuMS0wLjksMi0yLDJzLTItMC45LTItMmMwLTE1LjQtMTIuNi0yOC0yOC0yOFMxMiwyNC42LDEyLDQwczEyLjYsMjgsMjgsMjhjMS4xLDAsMiwwLjksMiwyUzQxLjEsNzIsNDAsNzJ6Ij48YW5pbWF0ZVRyYW5zZm9ybSBhdHRyaWJ1dGVUeXBlPSJ4bWwiIGF0dHJpYnV0ZU5hbWU9InRyYW5zZm9ybSIgdHlwZT0icm90YXRlIiBmcm9tPSIwIDQwIDQwIiB0bz0iMzYwIDQwIDQwIiBkdXI9IjAuOHMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiAvPjwvcGF0aD48L3N2Zz4=');
background-size: 16px 16px;
background-repeat: no-repeat;
background-origin: content-box;
background-position:right 5px center;
}
.inputpicker-div input.loading-msie-patch {
background-image: url("./res/spinner.gif");
}
.inputpicker-multiple-selected{
display: inline-block;
float:left;
}
/* multiple ul */
.inputpicker-multiple-selected ul {
display: inline-block;
padding:4px;
margin:0px;
}
.inputpicker-multiple-selected ul > li {
list-style-type:none;
display: inline-block;
margin-right:5px;
border:1px solid #888888;
padding:1px;
cursor:pointer;
}
.inputpicker-multiple input, .input-span {
padding:0;
margin:0;
border:0 none;
font-family:Sans-serif;
white-space:pre;
max-width: 100%;
max-height: none;
min-height: 0;
text-indent:0;
background:transparent;
box-shadow: none;
outline:0;
}
.inputpicker-multiple {
display: inline-block;
float: left;
}
.inputpicker-multiple ul {
margin:0;
padding:0;
}
.inputpicker-multiple ul > li {
list-style-type:none;
display: inline-block;
/*margin-right:5px;*/
cursor:pointer;
}
.inputpicker-multiple ul > li.inputpicker-element {
/*border:1px solid #888888;*/
margin: 2px;
padding:1px;
background-color: #f3f3f3;
}
.inputpicker-multiple ul > li.inputpicker-multiple-input {
margin-left:2px;
/*padding-left:5px;*/
}
.inputpicker-pagination {
background: transparent;
}
.inputpicker-pagination a {
padding-left:3px;
padding-right:3px;
}
.inputpicker-pagination span.current-page {
min-width:50px;
text-align: center;
display: inline-block;
}