set columnGroupShow via api - ag-grid

Is there a way to set columnGroupShow via the ColumnApi or GridApi in ag-grid? My project needs to toggle the ability to hide/show a column upon expanding the column group in real-time

You can use the columnApi.setColumnGroupState() function to open or close your column group:
https://www.ag-grid.com/angular-data-grid/column-state/#reference-state-setColumnGroupState
to open a column group, just pass the following arguments
stateItems: ({ groupId: "myColumnGroupId"; open: true; })

Related

Select first value of Bootstrap Auto Complete

I am using bootstrap autocomplete with custom resolver.
I want to select first option programmatically based on response coming from search event function. I could not find any method to select specific option programmatically in their API https://bootstrap-autocomplete.readthedocs.io/en/latest/
I have tried playing with following method but it sets the value and then that value starts searching.
$('.myAutoSelect').autoComplete('set', { value: myValue, text: myText });

Create a variable in Prometheus/Grafana with all values selected by default

I'm using Grafana with Prometheus as a Datasource.
I'm trying to create a variable with a filtered list of servers and I want to use this list to fix list of servers to display in my Dashboard.
My variable, named servers_front, is a query (label_values(info_fqdn)) with a regex to choose my servers /.*_front/
I want to use this full list of servers by default without displaying a combobox to choose which one I want to display.
Another requirement : If a new server that matches /.*_front/ is created, I want the list is automatically updated
Edit the variable
Variables > Edit > Selection Options >enable Include All option >Custom all value>.*
When saving dashboard you have an option to "save current variables", which means that currently selected value will be stored as a default when dashboard is loaded.
So if you have a templating variable with enabled "All" option you can save your dashboard ensuring "All" is selected (with option mentioned above enabled) and it should work.
Note that what is stored in dashboard is real "all" option and not an expanded list of all currently present values, so it should be dynamically expanded.
If you want that variable hidden then either you can hide the variable and save again after changing and saving its value or (if you have variable hidden from the start you can open url for dashboard with "&var-servers_front=All" appended (which will force variable to have "All" value and save dashboard with "save current variables".

install4j: Configurable form change visibility from drop-down list

I have a Configurable Form and i want to change the visibility of another field based on the value of a Drop-down list.
For example I have a Drop-Down list with entries A,B and the variable name for it is testDD.
I have a Text field smtpMailServer that I want to display only if testDD's value is A.
I have tried the following approaches in smtpMailServer's visibility without success:
return ((String) context.getVariable("testDD")).equals("A");
return (context.getVariable("testDD")).equals("A");
and I've also tried to add a script to testDD Change Selection Script with The following code
context.setVariable("ThisFormConfiguration", selectedItem);
And use the code above with ThisFormConfiguration instead of testDD. But it's not working.
Could you please help me?
Thanks!
I have tried the following approaches in smtpMailServer's visibility without success
The visibility script of a form component is only evaluated when the form is shown. You should keep it, but it only handles the initial condition.
and I've also tried to add a script to testDD Change Selection Script with
The following code context.setVariable("ThisFormConfiguration", selectedItem); A
Using the "Selection change script" property is the right idea, but your script has no effect. There is no live binding from the variables to the form components, the variable is read when the form is shown and updated when the user clicks "Next".
You have to use the following selection script:
formEnvironment.getFormComponentById("123").setVisible(selectedItem.equals("A"));
where "123" has to be replaced by the ID of the text field.

SAPUI5: how to make select field read-only

I made a combobox using sap.m library:
var oSelection = new sap.m.ComboBox({
name: <name>,
id: <id>,
items: {
<items here>
})
},
});
Now, how do I make this field kind of read only, so when I tap it on mobile, it wouldn't bring up the mobile's keyboard, but it would bring up the selection options?
I've tried to use editable: false, but it disables the selection together with keyboard.
Thank you.
From what I could find out there's no method that allows such behaviour.
One option, that I personally would not advice, is to access the HTML DOM and disable the input field that composes the sap.m.Combobox component.
Keep in mind that if the development SAPUI5 changes the inner workings of the Combobox component your code could be broken if you update the SAPUI5 libraries.
This being said, to use this option you could do something like:
oSelection.onAfterRendering = function() {
if (sap.m.ComboBox.prototype.onAfterRendering) {
sap.m.ComboBox.prototype.onAfterRendering.apply(this);
}
document.getElementById("<id>-inner").disabled=true;
}
replace the < id>-inner by the correct id given to your component.
This was tested using version 1.22.8 of SAPUI5 development toolkit.
Use sap.m.Select instead of sap.m.ComboBox.
Select does not provide the ability to edit the field content.
In many instances the Select control can directly replace a ComboBox without any other changes to the properties or the items aggregation!

Populate a Dynamic Field Dropdown List in OTRS

I need to add a dropdown in the New Ticket Screen of OTRS. I managed to add a Dropdown by adding a Dynamic Field with the help of Dynamic Fields Management in Admin Section.
Now my problem is that I want to populate this Dropdown with data that I get from some distant database on the run and dependin on the User Loged In. How can i feed In this Dynamic Data in the DropDown List in OTRS ?
Thank you.
To do such a thing I do not believe is supported from the Dynamic Field UI provided by OTRS.
So you can either:
1- add all the possible values into the drop down box and then hide/show them using code changes in the dtl file. (use javascript).
For creating a new ticket there is either AgentTicketEmail.dtl or AgentTicketPhone.dtl.
There is also the CustomerTicketMessage.dtl if you want to include it in the customer interface too.
2- Add only one value which you can also hide using javascript in the dtl files and just add values to the dropdown list using javascript code.
Example javascript below hides/shows different dynamic fields. You can find what your dynamic field is called by looking at the page source from your browser.
function setdynamicviews(){
switch ($('#Dest').val() ) { //this is where the queue is relevant (Dest = Queue)
case "8\|\|Support": // need to slash escape the pipes
//show dynamic fields
document.getElementById('LabelDynamicField_Product').style.display = 'block';
document.getElementById('LabelDynamicField_SerialNo').style.display = 'block';
break;
default:
//hide dynamic fields.
document.getElementById('LabelDynamicField_Product').style.display = 'none';
document.getElementById('LabelDynamicField_SerialNo').style.display = 'none';
}
}
To add items to usign javascript see here
Yuu have not provided enough information for me to help with getting the information "from some distant database"
Note: if you do change any DTL files or other otrs files you should defrinitely create a theme first see here
Hope this helps.