I'm using selectize.js to style text boxes, and it's working fine.
$("select[name='somename']").selectize({
valueField: 'id',
labelField: 'name',
searchField: 'name',
options: selectableThings,
render: {
option: function(item, escape) {
return render(someTemplate, item);
},
item: function(item, escape) {
return render(someTemplate, item);
}
}
});
However I have a limited range of items and do not wish for the cursor (flashing |) to be enabled all the time. I've searched through the API docs and the source but can't find anything obvious.
Is there something inbuilt to disable the flashing cursor?
Edit originally has this as 'disabling input' but it looks like the cursor can't be used for input (and disabling input still shows the cursor).
Selectize isn't particularly designed to act just as a select decorator. The cursor comes from an <input>
element that allows the user wittle down options. Hiding the input will create strange behavior when the user types. Also, when the control is empty, the input is used to display the placeholder text.
Technically you can hide the cursor (and input) with CSS:
/* option a: make transparent */
.selectize-input input {
color: transparent !important;
}
/* option b: position off-screen */
.selectize-input input {
position: absolute !important;
top: -9999px;
left: -9999px;
}
But again, this is going to feel funky. I'll look into writing a decorator_only
plugin that disables keyboard handling, but it's not an immediate priority.
http://jsfiddle.net/mARDE/1/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With