DP19 Advanced App Building
Hello, I'm starting to explore DP19's advanced app courses and trainings.
In my testing app, I've made some changes to the original code shown by Jason Hodges, and I have some questions
1. For the attachment, how can I make it to open in a new window instead of downloading every time?
I have this:
As you can see, I already set my code with the target=_blank parameter, but it keeps downloading the attachment.
This is the source code for that highlighted part
function renderPosts(data){
var postList= '';
data.forEach(post => {
domo.get('/domo/users/v1/' + domo.env.userId + '?includeDetails=true').then(function(me){
ByWho=me.displayName;
getUserAvatar(post.content.user).then(avatarURL => {
postList +=
`<li class="list-group-item">
<div class="inline">
<img src="${avatarURL}" height=50/>
<span class="badge badge-primary">${ByWho}</span>
<br>
<small>${post.content.postBody}</small>
</div>
<div class="attachmentWrapper">
<a href="${post.content.attachmentURL}" target="_blank">
<span class="badge badge-secondary">${post.content.attachmentName}</span>
</a>
</div>
</li>`
posts.innerHTML = postList;
})
});
});
}
2. The post rendered each time there is a new entry, it orders itself from first to last, how can I make it to display the last post at the top?
3. Is it possible that, if I need to add/remove columns to my collection, I don't have to republish my app with a new ID, so that it can update itself just by adding/removing the columns?
Thanks in advance for the help.
Comments
-
Hello,
Have you tried using domo.navigate rather than an href? You can find some more information on the DomoJS functions here: https://developer.domo.com/docs/dev-studio-references/domo-js
Regarding sorting the returned results, the easiest way would probably be to store them as an array rather than as a long string, then you can sort the array with built in JS methods like array sort().
You can run domo publish with the same ID, and it will udpate with the new data.
1 -
1) domo.navigate is a function only for the Domo CLI, so I guess I'll have to declare it in a js file, then pass the parameter for the attachment (?????)
2) I sorted out that issue by querying the results instead of displaying the long string
3) Gonna have to be watching that behavior, so far I've only re published with different app ID to get the changes I need.
Thanks!
0
Categories
- All Categories
- 1.7K Product Ideas
- 1.7K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 292 Workbench
- 4 Cloud Amplifier
- 8 Federated
- 2.8K Transform
- 95 SQL DataFlows
- 603 Datasets
- 2.1K Magic ETL
- 3.7K Visualize
- 2.4K Charting
- 697 Beast Mode
- 43 App Studio
- 39 Variables
- 658 Automate
- 170 Apps
- 441 APIs & Domo Developer
- 42 Workflows
- 5 DomoAI
- 32 Predict
- 12 Jupyter Workspaces
- 20 R & Python Tiles
- 386 Distribute
- 111 Domo Everywhere
- 269 Scheduled Reports
- 6 Software Integrations
- 113 Manage
- 110 Governance & Security
- 8 Domo University
- 30 Product Releases
- Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 98 Community Announcements
- Domo Community Gallery
- 4.8K Archive