Refresh One List Item
Hi Doug,
Please try the following handler JavaScript code:preAppery('picturename', this).asset('src','URL'),/preThe second parameter 'this' in Appery function.
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
Hi Doug,
Please try the following handler JavaScript code:preAppery('picturename', this).asset('src','URL'),/preThe second parameter 'this' in Appery function.
Now it's not letting me in the list at all. Getting this error in my list services:
precode
{
"status":"500 Internal Server Error",
"url":"https://api.appery.io/rest/1/db/collections/prayerRequests",
"response":"<html><head><title>JBoss Web/7.0.17.Final - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size=
{
"status":"500 Internal Server Error",
"url":"https://api.appery.io/rest/1/db/collections/prayerRequests",
"response":"JBoss Web/7.0.17.Final - Error report<!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}-- HTTP Status 500 - /code/pre
The error listed above fixed itself (or you did...thank yoU!). However, the code you provided doesn't work; it shoots an uncaught error with "no such asset"
Hello! Try this code:
preAppery('picturename', this).attr('src','URL');/preBy the way if your image is uploaded to app it's better to get path to image this way:
preAppery.getImagePath('new_image_name.png');/pre Then code would look like this preAppery('picturename', this).attr('src', Appery.getImagePath('new_image_name.png'));/pre
That worked perfect!
Part of this process is to update one of the labels. After you click the button, it adds one to a counter variable. The label reads this value from the database and updates it on the screen.
Any ideas on how to do this without running the list service again?
Hi Doug,
You can change Label value via JS without requesting the database. For example, run the following code on Click event:preAppery("labelName", this).text(newValue);/pre
Perfect, thank you!
Here's the code if anyone else finds this helpful!
precode
//Change number
var selectedPrayer = Appery('prayerNo', this).text(); // HIDDEN LABEL TEXT to VARIABLE
var newPrayer = ++selectedPrayer; // ADD ONE
Appery('prayerNoText', this).text(newPrayer+' people prayed!'); // CHANGE TEXT ON TEXT LABEL
//Change Thumb to Green
Appery('prayerThumbPic', this).attr('src','image url');
/code/pre
Katya, any idea why the following has no effect on my list (which is static). Do I need some type of refresh? Thank you.
Appery("mobilelistitem_6", this).text("hello");