Oracle Apex font on a row selector - oracle-apex

I have been asked if I can modify my oracle apex interactive grid to make the row selector column wider, bold and add a title is possible. I know how to do this for a column but I am not sure it is possible for an interactive grid row selector. Any help or an example would be helpful.. Thank you

Wow, this was a tricky one. I think I've figured it out (many thanks to John Snyders!). Assuming the IG has an id of 'emp', the following should work:
Add the following CSS to the page's Inline property under CSS. This will handle the styling of the checkbox, the checkmark in the checkbox, and it will show the column's header which is hidden by default. You can remove the #emp selector if you want to target all IGs on a page.
/* Style the box */
#emp .u-selector {
border: 2px solid #000;
padding: .5px;
}
/* Style the check in the box */
#emp .u-selector:before {
font-weight: 900;
color: #000;
}
/* Show the row selector column header */
#emp .a-GV-headerLabel {
position: relative;
}
#emp .a-GV-table th {
white-space: normal;
}
Next, add the following JavaScript code to the page's Execute when Page Loads property under JavaScript.
var igRegionId = 'emp';
var widgetInst = apex.region(igRegionId).call('getViews').grid.view$.data('apex-grid');
var orgRefresh = widgetInst.refresh;
widgetInst.refresh = function() {
orgRefresh.call(widgetInst);
$('.u-vh.a-GV-headerLabel').text('Hello World!');
};
widgetInst.refresh();
Finally, add the following JavaScript to the IG region > Attributes > JavaScript Initialization Code. This will resize the column as needed:
function(config) {
config.defaultGridViewOptions = {
rowHeaderWidth: 100
};
return config;
}

Related

React Native Render HTML bullet list is not centered with text

I'm using react-native-render-html library to display data from Django Rest Framework stored in RichTextUploadingField from django-ckeditor. As basic styling is working properly I have a problem with the <ul> tag - text is not centered with circle/square/number as shown in the image. I tried using renderersProps like:
<RenderHTML renderersProps={{ ul: { markerBoxStyle:{ paddingRight: 3, top: 5 }, markerTextStyle: { color: "red" } } }} />
But it works for specific text size. If I change the text size in style in Django admin, the element and text aren't centered again. Is there any option on how to fix it or what causes the problem?
You could add a custom CSS class to unordered list items only. Then apply your styles to that CSS class.
// this function goes through every list item in <ul> only and adds your custom class ('ul-li' in my case)
const onElement = (el) => {
const { children, name } = el;
if (name === 'ul' && children && children.length) {
children.forEach(listItem => listItem.attribs = {class: 'ul-li'})
}
}
// define your styles for your custom class
const classesStyles = {
"ul-li": {
lineHeight: '21px', // for me adjusting lineHeight did the job
}
}
// in your JSX
<RenderHtml
source={source}
contentWidth={width}
tagsStyles={tagsStyles}
... // other props you may have
domVisitors={{onElement}} // first alter your html
classesStyles={classesStyles} // then apply styles
/>
Sources:
classesstyles
onElement

Modifying the css of a widget C++ GTK

I am trying to edit the css of a tree view model (list store), I have set everything up using this code and it works perfectly:
auto css_provider = Gtk::CssProvider::create();
css_provider->load_from_path("style.css");
Gtk::StyleContext::add_provider_for_screen
(Gdk::Screen::get_default(), css_provider,
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
This code successfully loads in the css file and I can change certain properties of the treeview, ive tested padding and that works fine, it applies padding to each row in the liststore:
treeview.view {
padding: 20px;
}
or
treeview * {
margin: 10px;
}
But if I try to reference the name of the treeview, it doesn't work (no errors or warnings):
#m_TreeView { /* or m_TreeView.view */
padding: 20px;
}
My main goal is to apply a margin between each row, but this also doesn't seem to work (no errors or warnings), I want to apply a margin to each row but reference the specific name of the tree view as I would have multiple tree views in my application:
treeview.view {
margin: 20px;
}
Tried to access the rows and tried to access the list stores children (*):
treeview row {
margin: 10px;
}
+
liststore * {
margin: 10px;
}
But if I try to reference the name of the treeview, it doesn't work (no errors or warnings):
The name you need is not the variable name. To give a name for CSS styling, you can set it by calling
void Gtk::Widget::set_name ( const Glib::ustring & name )

How to use images inside a select component in Ionic 2

I am trying to put an image inside a Select component in Ionic 2 :
I have put the image source files inside the www/img folder in my Ionic 2 project.
However, using a simple img-tag does not display any image using this code:
<ion-list>
<ion-item>
<ion-label>Gaming</ion-label>
<ion-select [(ngModel)]="gaming">
<ion-option value="nes">
NES
<img src="img/myImage.png">
</ion-option>
</ion-select>
</ion-item>
</ion-list>
Does anyone have any idea?
The ion-select component doesn't allow direct customization to itself and anything that you add to ion-select and ion-option which is not as per the ionic documentation, will be ignore in the generated output.
You cannot add class or style to the component.
One way to do this is to put the ion-select in a parent element like div or ion-row etc. with class and apply the CSS rules using .parentclass childElement selector.
To show the images in option check the function below:
prepareImageSelector() {
setTimeout(() => {
let buttonElements = document.querySelectorAll('div.alert-radio-group button');
if (!buttonElements.length) {
this.prepareImageSelector();
} else {
for (let index = 0; index < buttonElements.length; index++) {
let buttonElement = buttonElements[index];
let optionLabelElement = buttonElement.querySelector('.alert-radio-label');
let image = optionLabelElement.innerHTML.trim();
buttonElement.classList.add('imageselect', 'image_' + image);
if (image == this.image) {
buttonElement.classList.add('imageselected');
}
}
}
}, 100);
}
I have implemented color and image selector using ion-select. Please refer https://github.com/ketanyekale/ionic-color-and-image-selector
You can also check the answer at Ionic select input of colours
I achieved it like this.
<ion-select (click)="loadFlags()" formControlName="pays" value="select-country">
<ion-select-option value="select-country" >select your country </ion-select-option>
<ion-select-option *ngFor="let country of countries" value="{{country.name}}">{{country.name}}</ion-select-option>
</ion-select>
And this is my .ts file
loadFlags() {
setTimeout(function(){
let radios=document.getElementsByClassName('alert-radio-label');
for (let index = 1; index < radios.length; index++) {
let element = radios[index];
element.innerHTML=element.innerHTML.concat('<img class="country-image"
style="width: 30px;height:16px;" src="'+countries[index-1].flag+'" />');
}
}, 1000);
}
Timeout is to let the system create alert componens. My Json is an array with elements like {name:"Cameroon",flag:"https://restcountries.eu/data/cmr.svg"}
On your basis, I have worked out a more concise solution!
The method 'prepareImageSelector' is used as the Click event of the control。
Thank you!
image: string = 'English';
prepareImageSelector() {
setTimeout(() => {
let buttonElements = document.querySelectorAll('div.alert-radio-group button');
if (!buttonElements.length) {
this.prepareImageSelector();
} else {
for (let index = 0; index < buttonElements.length; index++) {
let buttonElement = buttonElements[index];
let optionLabelElement = buttonElement.querySelector('.alert-radio-label');
let image = optionLabelElement.innerHTML.trim();
if (image == this.image) {
optionLabelElement.innerHTML += '<img src="assets/img/English.png" style="width:20px;height:20px;float:right;"/>';
}
}
}
}, 100);
}
There are already some great answers, and I honestly think Select with some images should have been part of the core Ionic library, but here we are.
I made the following adaptations for my answer:
Implemented with Ionic Vue (Ionic 6, so it's still an issue)
Flags for the countries are nested in a country JSON obtained from an API call.
Implemented for Action Sheet instead of Alert as the other answers
Flags appear on the left instead of the right
First, the HTML:
<IonSelect #click="loadFlags()" placeholder="Country" :interface-options="customAlertOptions" interface="action-sheet" cancelText="Cancel" style="width: 100%" v-model="selected_country">
<template v-for="(country, index) in countries" :key="index">
<div class="ion-text-center">
<IonSelectOption :value="country.code">
<IonLabel>{{ country.name }}</IonLabel>
</IonSelectOption>
</div>
</template>
</IonSelect>
And then the Javascript:
loadFlags() {
let that = this;
setTimeout(function() {
let radios = document.getElementsByClassName('action-sheet-button-inner');
for (let i = 0; i < that.countries.length; i++) {
let element = radios[i];
element.innerHTML = `<div style="display: flex; position: relative; width: 100%"><img style="width: 40px;height:40px;" src="${that.countries[i].flag}"/>`
+ `<span style="font-size:16px; position: absolute; top:10px; left: 70px;">${element.innerHTML}</span></div>`
}
}, 10)
}
Even though it's a little crude, the innerHTML in the loadFlags function, with some HTML and CSS, can be used to achieve almost anything.

Why does this CSS transition event not fire when two classes are added?

CSS
.horizontalTranslate {
-webkit-transition: 3s;
}
.secondClass {
background: red;
}
HTML
<div class='box'></div>
JS
var box = document.querySelector('.box');
box.addEventListener('webkitTransitionEnd', function(evt) {
alert('Finished transition!');
}, false);
function transitionBox() {
// this works
box.className = 'horizontalTranslate';
// this does not work
// box.className = 'secondClass horizontalTranslate';
}
setTimeout(transitionBox, 100);
Why does the transition event not fire when two classes are added rather than one? I've also tried chaining my CSS selector, a la .secondClass.horizontalTranslate { ... }.
The reason is that box.className = 'horizontalTranslate'; is actually removing styling, causing the CSS transition to actually happen. But when I set box.className = 'secondClass horizontalTranslate';, the styling of the DOM node is not changing and no event is fired.
Another way to write transitionBox is this:
function transitionBox() {
box.classList.add('horizontalTranslate');
box.classList.add('blue');
}
If blue changes the styling of box, this works too.

Oracle APEX: Tooltip on cell of the report

I have an APEX tabular form, all columns of which are standard report columns.
Is it possible to display a tooltip on mouse over of a particular cell of the report?
In the report column attributes look for the region named Column Formatting. Inside this section is a text box for an "HTML Expression". Here you can add html to the report column contents e.g., <span title="My tooltip text">#COLUMN_NAME#</span>
The tooltip text could be from another column, you would just replace the contents of the title attribute with the column name surrounded by hashes.
SOLUTION 1:
If your record needs to be editable then this solution works:
Under column attributes go to LINK
For Target: Type - URL and URL is just a hashtag
URL: #
Link Text: &COLUMN_NAME.
Link Attributes: title="&COLUMN_NAME." class="column_name_class"
Then in your inline CSS add the following
.column_name_class{
text-decoration: none !important;
}
Solution one I definitely prefer. But here is solution 2 anyways.
SOLUTION 2:
See here for the solution on JSDoc: Widget Grid
You can also initialize the grid with the tooltip option specified.
function( options ) {
options.defaultGridViewOptions = {
tooltip: {
content: function( callback, model, recordMeta, colMeta, columnDef ) {
var text;
// calculate the tooltip text
return text;
}
}
};
return options;
}
} );
Calculating the tooltip :
config.defaultGridViewOptions = {
tooltip: {
content: function( callback, model, recordMeta, colMeta, columnDef ) {
return model.getValue( recordMeta.record, "COLUMN_NAME");
}
}
}