How can I disable selected attribute from select2() dropdown Jquery? - attributes

I know how to enable the selected attribute from dropdown; I can use this code :
$('select').select2();
but my problem is how to disable it ? thx

The right way for Select2 3.x is:
$('select').select2("enable", false)
This works fine.

For those using Select2 4.x, you can disable an individual option by doing:
$('select option:selected').prop('disabled', true);
For those using Select2 4.x, you can disable the entire dropdown with:
$('select').prop('disabled', true);

The below code also works fine for Select2 3.x
For Enable Select Box:
$('#foo').select2('enable');
For Disable Select Box:
$('#foo').select2('disable');
jsfiddle: http://jsfiddle.net/DcunN/

To disable the complete select2 box, that is no deletion of already selected values and no new insertion, use:
$("id-select2").prop("disabled", true);
where id-select2 is the unique id of select2. you can also use any particular class if defined to address the dropdown.

In selec2 site you can see options. There is "disabled" option for api. You can use like :
$('#foo').select2({
disabled: true
});

As of Select2 4.1, they've removed support for .enable
$("select").prop("disabled", true); // instead of $("select").enable(false);
From: https://select2.org/upgrading/migrating-from-35

As the question seems unclear, I'm sorry if this answer is not directly related to the original intent.
For those using Select2 version 4+ and according to official plugin documentation, .select2("enable")is not the way to go anymore for disabling the select box (not a single option of it). It will even be completely removed from version 4.1 onward.
Quoted directy from the documentation (see https://select2.org/upgrading/migrating-from-35#select2-enable):
Select2 will respect the disabled property of the underlying select element. In order to enable or disable Select2, you should call .prop('disabled', true/false) on the element. Support for the old methods will be completely removed in Select2 4.1.
So in the previous answer's example, it should be:
$('select').prop(disabled,true);

As per select2 documentation: Click Here
If you wants to disable select2 then use this approach:
$(".js-example-disabled").prop("disabled", true);
If you wants to enable a disabled select2 box use this approach:
$(".js-example-disabled").prop("disabled", false);

I'm disabling select2 with:
$('select').select2("enable",false);
And enabling it with
$('select').select2("enable");

$('select').select2('enable',false);
This works for me.

I'm disable on value:
<option disabled="disabled">value</option>

if you want to disable the values of the dropdown
$('select option:not(selected)').prop('disabled', true);
$('select').prop('disabled', true);

Related

videojs disable full screen on double click

I want to completely disable full screen functionality.
I removed fullscreen button like this.
videojs('videoPlayer', {
controlBar: {
fullscreenToggle: false
}
});
But on double click it still goes to full screen.
How to disable double click?
Darius Oleskevicius helped me with the answer on videojs github page: https://github.com/videojs/video.js/issues/5604
The current dblclick handler doesn't take into consideration whether fullscreen toggle is disabled. It is on by default and there is currently no settable option to disable it. As of now, you could try and cancel out dblclick listener on tech (see below).
player.ready(function() {
player.tech_.off('dblclick');
});
Also if you use reset function, you have to again remove dblclick event listener.
As of Video.js 7.5.0, there is an an option to turn it off directly
videojs("my-player", {
userActions: {
doubleClick: false
}
});
You can use CSS to initialize the various control-bar objects
to exist or not.
See, for example: https://github.com/videojs/video.js/issues/2507
So, for your case, just use:
<style>
.video-js .vjs-fullscreen-control { display: none; }
</style>
EDIT:
Ok, I figured out what's up with the "double-click" !
I still run all my video pages, using version 5 of videojs.
Version 5.11.9, to be exact.
And, it turns out that double-clicking on a video back then, did NOTHING.
So, bottom line, if you truly 'want to disable 'double-click-to-fullscreen',
it can be done. Just use 5.x, rather than 6.x or 7.x
Having said all that, I now have to consider this a bug in 7.x (and 6.x).
The code inside videojs SHOULD be testing whether the fullscreen-control
exists or not, and if not, the double-click should NOT be going to fullscreen.
The list of versions is here: https://github.com/videojs/video.js/releases
Just I added controlsList="nofullscreen" attribute. But playing the video on click on the center of won't work. So I added onclick="vd.play()" attribute. <video id="vd" src="video.mp4" onclick="vd.play()" disablePictureInPicture controls controlsList="nofullscreen"></video>

How to add tabindex to xe:djComboBox

I need to add a tabIndex to a page that contains several Dojo Combo Boxes from the XPages Extension Library. It seems that the tabIndex property is not supported.
The XSP editor says it is an "unknown property" and "not defined on tag ".
Does anyone know how to add this property?
Note: In this application, jQuery is not available to use.
This code works for me
<xe:djComboBox id="djComboBox1" tabIndex="3"></xe:djComboBox>
<xe:djComboBox id="djComboBox2" tabIndex="2"></xe:djComboBox>
<xe:djComboBox id="djComboBox3" tabIndex="1"></xe:djComboBox>
I never used them and have to DDE available yet but can you define the tabindex attribute via the attrs property list of the control?

Overriding a controls renderer

I'm having the following issue with the OpenNTF Bootstrap4XPages plugin: the NamePicker control uses a the Bootstrap renderer which displays it without the search field or the "add" field. I have raised this an issue on OpenNTF but in the meantime, I figured I would attempt to apply the ExtLib renderer for this control.
To date I have tried adding "com.ibm.xsp.extlib.OneUINamePicker" directly to the Renderer-Type property on the control (didn't work), added a renderer property set (taken from the ExtLib source) to the faces-config.xml (didn't work) both with theme enabled and disabled on the control.
So my questions are a) is this possible and b) if so, what am I doing wrong?
Thanks to Tim's comment, I had a moment of clarity in which I realised that I had been an idiot and had overcomplicated matters. I didn't need to worry about changing the renderer-type/adding a custom renderer. The simple answer was just to disable the theme for the NamePicker control which then forced it to use the ExtLib renderer anyway, giving me back the search button and both fields, albeit without styling.
The issue only occurred with the Bootstrap 3 themes. In the Bootstrap 2 themes, the correct renderer class was used.
I traced this down to a bug in the ExtLib theme file for Bootstrap 3. I've fixed it in the source code by setting the correct renderer class, so this will be solved in the next release.
See also: https://github.com/OpenNTF/Bootstrap4XPages/issues/59

How can I implement Drag and Drop (Shuffling of rows) in Datatable of primefaces?

I am using Primefaces DataTable to display content in a grid. I want to reorder these rows using drag and drop(shuffle), I have tried jquery sortable, it works only ones, after that I need to refresh the browser.
Is there any way to implement that?
Thanks a lot
This feature is now available from PrimeFaces 5.0:
Usage is very simple by just enabling draggableRows option and also an optional rowReorder ajax behavior is provided getting a ReorderEvent with index information for flexibility.
Source : http://blog.primefaces.org/?p=3026
You can also have a look at the showcase here: http://www.primefaces.org/showcase/ui/data/datatable/reorder.xhtml
There is currently no way to have row-sorting with server side effects. You can achieve client side reordering using jQuery, but this is not stored on the server.
$('.ui-datatable tbody').sortable();
There is a discussion on the PrimeFaces forum.
There is also an issue about drag/drop capability in PrimeFaces' issue tracker. Note that the issue is closed as WontFix, so I guess you're out of luck.

How to disable drag and drop feature in ExtGWT

I am using EditorGrid in ExtGWT. currently DnD feature is enabled. i want desable in particular context. please help me how to achieve this.
Thanks!
You can call DropTarget's disable() OR DragSource's disable() method to either disable Dragging OR Dropping.
You can also change the "group" field of DropTarget or DragSource (using setGroup) to have a mistmatch between both of them to disable DnD.

Resources