How can I populate a drop-down menu in an html.ftl file with database table data in Moqui?

Looking for guidance on integrating a database table into a dropdown menu in the Header.html.ftl file of my application built with Moqui Framework. Wondering about the best approach to incorporate service-call within Html.ftl for this purpose. Open to suggestions or alternative methods for loading the data effectively.

Answer №1

To prepare data in a similar manner, one can utilize the Moqui API within an #assign directive in an FTL file. However, it is generally recommended to handle this within the screen.actions element of the corresponding screen rather than directly in the FTL file.

For examples on using the Moqui API through an ec.entity.find() call in an FTL snippet, refer to the SimpleScreensSetupData.xml file located in the moqui/SimpleScreens repository. This file contains data that populates the database to incorporate a header navbar item with a concise FTL template displaying relevant messages and events.

An excerpt from the file exemplifies this:

<#assign taskCount = ec.entity.find("mantle.work.effort.WorkEffortAndParty").condition("partyId", ec.user.userAccount.partyId!).condition("statusId", "not-in", "WeClosed,WeCancelled").condition("workEffortTypeEnumId", "WetTask").disableAuthz().count()>

To successfully utilize this data for iteration, you will require a modified version of this code snippet that retrieves a list for iteration using the FTL #list directive.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Access a file from a remote server and display its contents on a web browser. This code handles both text and HTML files, but does not support image files

I came across this small piece of code: var target = 'https://i.sstatic.net/5CXfX.png'; //An example, a .PNG image //Testing with text/html and text/plain and image/png res.setHeader( 'Content-Type', 'image/png' );//res repr ...

The specific model cannot be utilized for custom control within the ViewSettingsCustomItem

Exploring examples to enhance my SAPUI5 knowledge, I encountered an unusual behavior when utilizing the ViewSettingsDialog component with a ViewSettingsCustomItem filter. In my controller, I initiate the Dialog in this manner: onOrdersFilterPress ...

Why are static PropTypes used in ReactJS and do they offer any solutions or are they merely a recurring design choice?

While delving into the code base of a web application, I came across some static PropTypes that left me questioning their purpose and necessity. Here is a snippet of the code in question: static propTypes = { fetchCricketFantasyPlayers: PropTypes.fun ...

Tips for addressing lag problems in my Three.js game as time progresses

My game in Three.js doesn't start off with any lag, but after a few minutes, the performance begins to slow down on computers running it. I've tried reviewing my code and checking my arrays, adjusting values to troubleshoot, but so far, nothing s ...

Using setTime in JavaScript allows for customizing and adjusting the

I'm having trouble getting this code to display the time. I thought it would work, but it's not showing the time. Can someone please help me figure out what's going wrong? function startTime() { var currentTime = new Date(); ...

The functionality of res.render() in express.js appears to be malfunctioning

I have a web application with Facebook login functionality. When the Facebook login button on my page is clicked, the following code snippet is triggered: FB.api( '/me', 'GET', {"fields":"id,name,birthday,gender"}, ...

Angular is displaying the main view two times instead of loading the appropriate template

I've encountered a perplexing issue with Angular templating - instead of loading the correct template, the main view is rendered twice. Despite investing a considerable amount of time over the past 48 hours attempting to resolve this issue, I have mad ...

How do I load a JSON response into an array using JQuery and AJAX?

Can anyone help me figure out why I'm only getting "undefined" in the alert box when I try to run this code? I want to populate the array outside of the .ajax function. $(document).ready(function() { var reviewArray = new Array(); getReview ...

Utilizing 'this' in jQuery: Image swapping with thumbnails, Twitter Bootstrap framework

Is it possible for jQuery's 'this' to simplify my code? You can view the full code here. Thank you for any help or suggestions. Here is the jQuery code: /* Ref: http://api.jquery.com/hover/ Calling $( selector ).hover( handlerIn, handler ...

What steps should be taken to incorporate that dynamic sliding element (like a sliding screen paper) on the webpage?

When hovering over the leftmost part of the homepage at www.techants.com, a box shifts to the foreground. I examined the code and noticed a reference to something called screen paper. Does anyone know which script is being used for this effect? How can I ...

Executing NodeJS Functions in a Particular Order

Just starting to learn Node and working on building an app. Currently, in my route file, I am attempting to connect to MySQL and retrieve the major of the user, then use it for other operations. However, when I run the webpage, the console displays that t ...

How about: "Performing a loop on an array in Java using

A program needs to take a specified number from the user, generate an array of that size, and allow the user to input grades using a do..while loop. The system should then show all entered grades from lowest to highest, calculate the total grades, and dete ...

The popup.html file was overlooked during the generation of the Chrome extension build with Vite

I'm currently utilizing a github CLI plugin found at this link to set up mv3 chrome extensions using vue and vite. The initial template is properly set up and I can work on it without any issues. However, I encounter a problem when trying to utilize ...

Once the user chooses the second option from the dropdown menu, the WebElement continues to display the details of the first option

In the dropdown list, each selection corresponds to a different URL. For example, selecting the first option reveals 10 hyperlinks, while selecting the second option reveals 5 hyperlinks. Issue - Despite selecting the second option, it continues to displa ...

Utilizing numerous iframe embeds with the YouTube API

As someone who has predominantly taught themselves to code, my knowledge is somewhat limited. I have a unique forum where I have implemented a feature to replace YouTube URLs in posts with embedded videos. One interesting aspect of this feature is that it ...

Using RegEx in Google Apps Script to extract HTML content

Currently, I am working with Google Apps Script and facing a challenge. My goal is to extract the content from an HTML page saved as a string using RegEx. Specifically, I need to retrieve data in the following format: <font color="#FF0101"> ...

Applying a condition to filter elements using AngularJS

I have created an array in my controller with the following data: var people = [ { name:"Alice", number:'808574629632', email:"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail ...

Unable to retrieve the value from a textarea when using Shopify Product Options by Bold

I'm currently facing an issue trying to retrieve the value of a textarea using Shopify's Product Options by Bold. The code works fine locally, but when I transfer it over to Shopify, I am unable to get the value. Despite looking at various resour ...

Issue with Vue 3 component not updating following vue-router invocation

I am currently working on developing a todo app using ionic-vue with vue 3. In my Lists.vue component, I have set up an overview where users can click on different lists to load tasks specific to each list. However, I am facing an issue where the same data ...

I am experiencing an issue with TestNGCucumberRunner and cucumber v6 where the parallel DataProvider is not generating the

After making multiple edits and adjustments to my setup, I am still facing an issue where TestNG output files are not being generated at the end of the suite execution. Here is a summary of my current project configuration: I have integrated Cucumber v6 w ...