Bootstrap-Vue B-Form-Checkbox not reacting to clicks even though it is enabled - bootstrap-vue

My bootstrap-vue b-form-checkbox is not reacting to clicks and does not change value.
Use of b-form-checkbox in template:
<b-form-checkbox
v-model="showArchived"
>
Show archived reports
</b-form-checkbox>
Binded property in the script:
data() {
return {
showArchived: false
};
},
What can be the problem? I tried setting disabled to false (didn't help, setting it to true does change styling, so I conclude the checkbox is enabled by default as it should), tried adding id or name properties, but it didn't help either. It's the only checkbox in the component.

The problem was cause by one of parent components having #click.prevent. Removing prevent made the checkbox reactive again.

Related

How to disabled a radio button list

The issue I have is that using Logic, if my trigger has an action that disables my component. The fact the trigger is false, makes it enable my component.
If fieldA value = 99 then disable fieldB. But it Field A is 10, then fieldB is enabled no matter what. I wish there was a way to make it so triggers were not if/else.
So I need to disabled a component with JavaScript. If I try fieldB.disabled = true; it just comes back with true, but the radio button list is not disabled.

How to prevent closing of cell editing in ag-grid on "Other Cell Focus"

I am working on an editable table in Angular application with ag-grid library. I would like to keep editing cells (in full row edit mode) until I finish with it and then close the editors manually via API. The problem is that the editor is closing on other cell click/focus (on some other line) as described here:
The grid will stop editing when any of the following happen:
Other Cell Focus: If focus in the grid goes to another cell, the editing will stop.
I cannot figure out how to disable this, if it is possible. Installing the onCellMouseDown() hook does not help, because the cellFocused event is fired before cellMouseDown. Therefore, the editing stops before I have a chance to intercept the mousedown event.
Here is my stackblitz little extract with related pieces of code.
The need for such scenario is that I want to validate the entry and not to allow a used to quit the editing if the form is not valid. The only workaround I found so far is that on any click outside of editing cells when the editor closing I reopen it right away in onRowEditingStopped() hook unless the editor has been closed via 'OK' button.
After all, I have managed to provide a custom solution that fits exactly into this problem which I was facing also.
First thing is to disable pointer events to non edited rows when a specific row is currently being edited. On Ag-grid's 'cellEditingStarted' callback I have added the following code:
public cellEditingStarted(event: any): void {
//not all rows are on dom ag-grid takes care of it
const nonSelectedGridRows = document.querySelectorAll('.ag-grid-custom-row:not(.ag-row-selected):not(.ag-row-editing):not(.pointer-events-none)');
forEach(nonSelectedGridRows, row => {
row.classList.add("pointer-events-none");
});
}
Because not all rows exist on dom (Ag-grid creates and destroys while you are scrolling )when a specific cell is being edited, I have also added a rowClassRule which is applied when rows are being created:
this.rowClassRules = {
'pointer-events-none': params => {
if (params.api.getEditingCells().length > 0) {
return true;
}
return false;
}
};
scss:
.pointer-events-none {
pointer-events: none
}
By disabling pointer events, when you click on a non edited cell the cell won't get focus and thus the currently edited cell will stil remain on edit mode. You can provide your own custom validation solution and close the editor manually through API. When you are done, you have to enable pointer events to all grid rows back again:
private enablePointerEvents(): void {
//not all rows are on dom ag-grid takes care of it
const nonSelectedGridRows = document.querySelectorAll('.ag-grid-custom-row.pointer-events-none');
forEach(nonSelectedGridRows, row => {
row.classList.remove("pointer-events-none");
});
}
I implemented the same above approach in Ag-Grid React.
I used getRowStyle callback for adding the css pointerEvents: none on dynemic basis.
It seems to be working for me fine.
Please refer the below code
const getRowStyle = (params) => {
// this is not initialized in read mode
// condition for me ==> currentEditRowIndex.current !== null && params.node.rowIndex !== currentEditRowIndex.current
if (someCondition for Row other than inline edit row) {
return { pointerEvents: "none" };
}
return null;
};
After adding this whenver you start the editing..You will need to call redrawRows so that css changes can be applied.
Hope this will help. Thank You!!
Thought I would share another solution that has been working out okay for me so far.
Using 'pointer-events-none' as suggested in the other answer is flawed because the Enter key can also close the editor.
In my case, I want to prevent the editor from closing when client side validation has failed and the data is invalid. When my conditions are met, I call stopPropagation() on the events to prevent the editor close from happening in the first place. It still has potential problems:
It cancels mousedown, dblclick, keydown, focusout and click for all elements that have a class name starting with ag- so if you happen to use this class prefix for other controls on the page, it could interfere. It also means any controls within the grid (sorting, resizing, etc.) don't work while the condition is met.
Calling stopPropagation() could potentially interfere with your own custom controls. So far I've been okay if I dont use the ag- prefix within the markup from my own custom cell editors and renderers
I hope they can add a proper API function to cancel the row/cell stopEditing function in the future.
["mousedown", "dblclick", "keydown", "focusout", "click"].forEach(function (eventName) {
document.addEventListener(eventName, function (e) {
if ( conditionForCancelingIsMet() ) {
// this appears to cancel some events in agGrid, it works for
// preventing editor closing on clicking other cells for example.
// It would be ideal if this worked for all ag-grid specific events
// and had a proper public API to use!
e["__ag_Grid_Stop_Propagation"] = true;
}
// convert element classList to normal js array so we can use some()
var classArray = [].slice.apply(e.target.classList);
if ( conditionForCancelingIsMet() && classArray.some(c => c.startsWith("ag-")) ) {
// unfortunately some events like pressing the 'enter' key still
// require stopPropagation() and could potentially interfere with unrelated controls
e.stopPropagation();
}
}, true);
});

Null Values in Checkbox Custom Fields

I'm noticing that editing a matter from the web interface and adding a checkbox custom field to the matter does not automatically set that checkbox to 'false.' Instead, unless you set the box to true, save it, and then re-edit it to uncheck that box, you cannot get a subsequent api call to return a 'false' value.
It strikes me that this ought to be corrected?
This is Matt G. from Clio's API support team.
You're correct that checkbox custom fields don't return a false value unless thy're actually toggled on and then off. Until some value is set, the checkbox field won't have any information stored in it and will return a null value.
We'll evaluate the functionality and look into updating how checkboxes work. In the meantime, if you want to get records of all Matters with an unchecked checkbox, you can look for Custom Field Values that are false and null.

GWT: Multi Selection model does not update the celltable status in some cases

I am using the GWT MultiSelectionModel within a CellTable in which I have a checkbox in one column and a widget in the other column. I have added handlers to update the selection status based on user clicks. If the user clicks on any part of either columns when the cell is selected, the status gets updated correctly and the cell turns white from light blue. Howvever, If the user clicks on the check box and the cell is selected, the check box gets unchecked but the cell is still blue. Even more strange: This issue does not happen if I have a few breakpoints before the status update code is executed.
In all other cases, the cell state and the checkbox state gets updated correctly. Note that I am not using the ProvidesKeys interface since the object do not change.
Can anyone help me with this? Thanks for your help.
Have you tried using a CheckBoxCell for your checkbox column and, specifically, the CheckboxCell(boolean dependsOnSelection, boolean handlesSelection) constructor (by passing true to both params)?
I've got almost the same problem when I use MultiSelectionModel. What's my walkaround is to see the checkbox's column as a special one and then to deal with it manually. Say:
myDataGrid.addCellPreviewHandler(
#Override
public void onCellPreview(final CellPreviewEvent<MyCellData> event){
if("click".equals(event.getNativeEvent().getType()) && 0 != event.getColumn()){
doWhatYouWant();
}
}
)

Configure Alfresco.util.PopupManagers YUI Dialog

I'm trying to configure the width for Alfresco.util.PopupManager.displayPrompt() but I don't see how to do it.
YUI Dialog has a width property, but the only config that I've managed to see, defaultDisplayPromptConfig object, doesn't seem to pay much attention to my messing with it.
Specifically, I tried setting Alfresco.util.PopupManager.defaultDisplayPromptConfig.width but it didn't work :)
I'm also trying to style up the panel I'm loading (create-site style injected panel), but it does not work for now.
Is there a way to configure the PopupManager Prompt object?
TIA
If you look at the source for Alfresco.util.PopupManager.displayPrompt() contained in alfresco.js then you'll see that the method creates an instance of YAHOO.widget.SimpleDialog, which does support a width property.
The problem is that displayPrompt() takes only specific configuration options which it passes through to the SimpleDialog, so adding an additional width parameter to your config will not have any effect, as you can see.
// Create the SimpleDialog that will display the text
var prompt = new YAHOO.widget.SimpleDialog("prompt",
{
close: c.close,
constraintoviewport: c.constraintoviewport,
draggable: c.draggable,
effect: c.effect,
modal: c.modal,
visible: c.visible,
zIndex: this.zIndex++
});
// Show the title if it exists
if (c.title)
{
prompt.setHeader($html(c.title));
}
// Show the prompt text
prompt.setBody(c.noEscape ? c.text : $html(c.text));
// Show the icon if it exists
if (c.icon)
{
prompt.cfg.setProperty("icon", c.icon);
}
// Add the buttons to the dialog
if (c.buttons)
{
prompt.cfg.queueProperty("buttons", c.buttons);
}
// Add the dialog to the dom, center it and show it.
prompt.render(parent);
prompt.center();
prompt.show();
I like the idea of enhancing the function to support a width property and possibly others, but in the meantime you are best off using SimpleDialog directly in your own code, modifying the above to add a width parameter.