Page 2 of 2

Refresh One List Item

Posted: Mon Nov 04, 2013 7:12 pm
by Kateryna Grynko

Hi Doug,

Please try the following handler JavaScript code:preAppery('picturename', this).asset('src','URL'),/preThe second parameter 'this' in Appery function.


Refresh One List Item

Posted: Mon Nov 04, 2013 7:37 pm
by Doug Black

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


Refresh One List Item

Posted: Mon Nov 04, 2013 7:51 pm
by Doug Black

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"


Refresh One List Item

Posted: Tue Nov 05, 2013 12:09 pm
by Maryna Brodina

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


Refresh One List Item

Posted: Tue Nov 05, 2013 12:58 pm
by Doug Black

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?


Refresh One List Item

Posted: Tue Nov 05, 2013 3:41 pm
by Kateryna Grynko

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


Refresh One List Item

Posted: Wed Nov 06, 2013 12:53 pm
by Doug Black

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


Refresh One List Item

Posted: Sat Jul 05, 2014 6:21 pm
by RobertJay

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