Popup LOV custom template

Popup LOV item type
One of my favorite item type in APEX is the popup LOV, users love it because of the ability to search even across multiple columns since version 19.2. It supports single and multiple value selection and can be displayed as an inline popup or a modal dialog.
By default, APEX displays the popup LOV as a list when there is only one column and as a grid when there are several columns.

Create a multiple columns popup LOV
For this example I have the list of the COVID19 vaccine center in France, I want to display the name of the center, the address, the zip code and the city. Start by creating a list of values in Shared Components with this query
select
id
, name
, street_number
, street
, zip_code
, city
from vaccine_center
Then, in the page, add a new item, choose Popup LOV as type and select the LOV under List of Values section attribute. The item should be displayed like this.
So how do I change this, if I want the information to be displayed on 3 lines?
Define a custom template
Under the Javascript Initialization Code attribute, you can change the options object to be used during the initialization of the popup LOV. I had trouble finding the correct substitution syntax, but once again, John Snyder wrote something useful about it in his blog post All the Things That Pop Up. Take a look at the sample application, if you want to have more details.
function(options) {
options.display = "list";
options.recordTemplate = (
'<li data-id="~ID.">' +
'<div class="content-address">' +
'<span class="center-name">~NAME.</span>' +
'<span class="center-address">~STREET_NUMBER. ~STREET.</span>' +
'<span class="center-city">~ZIP_CODE. ~CITY.</span>' +
'</div>'+
'</li>').replace(/~/g, "&");
return options;
}
The item should be displayed like this now.
Not so bad, but we can make it better by applying this simple CSS rule to the page (learn more about flexbox here
.content-address {
display: flex;
flex-direction: column;
}
And like magic, the popup LOV is now displayed in 3 lines as I wanted.

Advanced examples
Here is two examples, one is a simple user list with small avatars and the second one is a cards list with avatars and icons.

List of values
In this two examples, I use the same list define with this query. Datas comes from randomuser.me which provides an API to get a list of users. Really cool when you want to build some demos!
select
u.id
, u.first
, u.last
, u.email
, u.phone
, u.large as picture
, u.country
, u.city
, u.age
, u.date_ as birthdate
, u.first|| ' '|| u.last as full_name
from user_data u
Simple List with Avatars
Javascript Initialization Code:
function(options) {
options.display = "list";
options.recordTemplate = (
'<li data-id="~ID.">' +
'<div class="content-list">' +
'<img class="avatar-list" src="~PICTURE." alt="User Avatar" loading="lazy">' +
'<div class="user-infos-list">' +
'<span class="user-name"><b>~FIRST. ~LAST.</b></span>' +
'</div>' +
'</div>'+
'</li>').replace(/~/g, "&");
return options;
}
CSS code:
.avatar-list {
border-radius: 10px;
width: 50px;
height: 50px;
}
.content-list {
display: flex;
flex: ;
flex-direction: row;
}
.user-infos-list {
margin: ;
margin-top: 15px;
margin-left: 15px;
}
Cards with Avatars and Icons
Javascript Initialization Code:
function(options) {
options.display = "list";
options.recordTemplate = (
'<li data-id="~ID.">'+
'<div class="card">' +
'<img class="avatar-card" src="~PICTURE." alt="User Avatar" loading="lazy">' +
'<div class="user-infos-card">' +
'<span class="user-name-card"><b>~FIRST. ~LAST.</b></span>' +
'<span class="user-info-card">' +
'<span class="fa fa-globe user-info-card-icon" aria-hidden="true"></span>'+
'<span class="user-info-value">~COUNTRY.</span>'+
'</span>' +
'<span class="user-info-card">' +
'<span class="fa fa-phone user-info-card-icon" aria-hidden="true"></span>'+
'<span class="user-info-value">~PHONE.</span>'+
'</span>' +
'<span class="user-info-card">'+
'<span class="fa fa-envelope-o user-info-card-icon" aria-hidden="true"></span>'+
'<span class="user-info-value">~EMAIL.</span>'+
'</span>' +
'</div>' +
'</div>'+
'</li>').replace(/~/g, "&");
return options;
}
CSS Code:
.user-infos-card {
margin: 1rem 1rem 1rem 2rem;
}
.user-name-card {
margin-bottom: 1.5rem;
}
.user-info-card-icon {
margin-right: 1rem;
}
.user-info-card {
margin-bottom: 0.5rem;
}
.card {
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
transition: 0.3s;
display: flex;
flex-direction: row;
}
.card:hover {
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
}
.user-infos-card {
display: flex;
flex-direction: column;
flex-wrap: wrap;
margin: 1rem;
}
.avatar-card {
width: 100px;
height: 100px;
border-radius: 50%;
border: solid 5px greenyellow;
margin-left: 1rem;
margin-top: 0.85rem;
}
What next?
Now, your imagination is the only limit to display nice popup LOVs in your application! You can find the live demo here
I hope you enjoyed these tips!
About the author
Oracle APEX Developer (Insum) from Paris Contributor of Flows for APEX Passionate about APEX and web development.
Comments
Join the discussionThat's Working, thank you so much!
How to show the Images within the Display Values if I choose Static Values ?
Hi, thanks for sharing this. One thing though, I can't access the demo app using the credentials on the login screen. Can you please check on that?
Hi Daniel Marasigan, Thank you for your comment and for letting me know that the demo user was unable to login anymore. It is fixed now!
Hii all this is Arun ur blog was extremely good but I am new to Oracle apex ~NAME. Is this static id of that column
Can anyone please respond quickly please I don't have enough time actually
ARUNKUMAR CN yes it's the column name in the query
Louis Moreaux Yeah thank you very much I thought that is the static id u mentioned under the Advance settings
I have one doubt in interactive grid I have added dynamic calculation between columns when I entered Amount and quantity I will get automatically total amount for grand total I have used to sum of total columns
The problem is whenever I deleted the row from grid the grand total page item is not getting actual grand total by excluding that deleted row
Can u please suggest me through this requirement
ARUNKUMAR CN please post your questions on the forum or the slack channel when it's not related to the blog post. Thanks
Louis Moreaux Thank you soo much
Louis Moreaux Louis Moreaux Hii Louis U know how to make apex input fields like how we can see input fields in Email Is this possible
actually I tried alot in Oracle forums but no-one helped with this requirement can u please
Hey Louis! I'm currently trying to implement the Simple List with Avatars on Oracle APEX 23.2.3 and it's not working. All the columns are correct and the URL of image is valid. Is it some version update issue? Or is there a new option? Thank you!
Hi Lázzaro Daudt da Costa, I just checked it and the demo page is still working on the latest version. It's probably something else. Did you see any JavaScript error in the console?
Louis Moreaux Yes, when opening the Popup LOV:
Uncaught TypeError: this.data$.iconList is not a function
Lázzaro Daudt da Costa Are you able to duplicate this error in apex.oracle.com? Which Oracle APEX version are you using?
Wicked Awesome Tip Brodha. Merci Beaucoup.
Happy you like it Neelesh! Avec plaisir!
Hey Louis, This is great. I have another requirement where in i want to restrict the query in the shared component LOV at run time. For example there is an item :p100_Customer
my shared component LOV is SELECT order_number, shipment_date, shipped_qty FROM table;
When my LOV is parsed i want to restrict it like below SELECT order_number, shipment_date, shipped_qty FROM table WHERE customer = :p100_customer;
Hi Sandeep,
Thank you for the comment, I am glad you like it!
You can use the bind variable in your shared LOV but don't forget to pass the item value in your page under Cascading List of Values attributes.
Louis Moreaux Thanks so much for the reply. I have tried this already, I was unable to see any cascading LOV attributes but still i went ahead and updated it, it did not work
Sandeep You should do what is explained in this video https://youtu.be/80GCL9lm4ZE
Great.. Louis Moreaux Thanks so much. that helps
If you don't mind can i ask one more help, Iam trying to bring the interactive grid records (in a popup modal) to lines table. User will be selecting records with check boxes in the popup. If you have done any videos in the past please help with the reference.
Louis Moreaux Hey Louis, There is a concern here, Actually i am not using the shared component LOV from the page item. The shared component LOV is on one of the columns in interactive grid at the lines level and i am unable to pass the value from the header level which is needed to restrict the LOV.
Louis, this is a great tip. Thanks for taking the time to share, we are looking to utilise this in our own application
Hi James, Thanks for your comment, I really appreciate it!
Hey Louis, thank you for sharing this. Today this helped me and made it a snap to implement in my application.
Hi Jorge, really happy to hear that. Thank you for the feedback!
How can I download the application
Hi, I do not plan to make this application available. But you should be able to duplicate the examples in your application. I will be more than happy to help you if you need to.




