Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

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.

Doug Black
Posts: 0
Joined: Wed Aug 14, 2013 11:36 am

Refresh One List Item

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&#47;7&#46;0&#46;17&#46;Final - Error report<&#47;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&#46;name {color : black;}HR {color : #525D76;}--><&#47;style> <&#47;head><body><h1>HTTP Status 500 - <&#47;h1><HR size=
{
"status":"500 Internal Server Error",
"url":"https:&#47;&#47;api&#46;appery&#46;io&#47;rest&#47;1&#47;db&#47;collections&#47;prayerRequests",
"response":"JBoss Web&#47;7&#46;0&#46;17&#46;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&#46;name {color : black;}HR {color : #525D76;}-- HTTP Status 500 - /code/pre

Doug Black
Posts: 0
Joined: Wed Aug 14, 2013 11:36 am

Refresh One List Item

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"

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Refresh One List Item

Hello! Try this code:
preAppery('picturename', this)&#46;attr('src','URL');/preBy the way if your image is uploaded to app it's better to get path to image this way:
preAppery&#46;getImagePath('new_image_name&#46;png');/pre Then code would look like this preAppery('picturename', this)&#46;attr('src', Appery&#46;getImagePath('new_image_name&#46;png'));/pre

Doug Black
Posts: 0
Joined: Wed Aug 14, 2013 11:36 am

Refresh One List Item

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?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Refresh One List Item

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)&#46;text(newValue);/pre

Doug Black
Posts: 0
Joined: Wed Aug 14, 2013 11:36 am

Refresh One List Item

Perfect, thank you!

Here's the code if anyone else finds this helpful!
precode
&#47;&#47;Change number
var selectedPrayer = Appery('prayerNo', this)&#46;text(); &#47;&#47; HIDDEN LABEL TEXT to VARIABLE
var newPrayer = ++selectedPrayer; &#47;&#47; ADD ONE
Appery('prayerNoText', this)&#46;text(newPrayer+' people prayed!'); &#47;&#47; CHANGE TEXT ON TEXT LABEL

&#47;&#47;Change Thumb to Green
Appery('prayerThumbPic', this)&#46;attr('src','image url');
/code/pre

RobertJay
Posts: 0
Joined: Fri Jun 15, 2012 1:32 pm

Refresh One List Item

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");

Return to “Issues”