Page 1 of 2

Refresh One List Item

Posted: Sun Nov 03, 2013 10:17 am
by Doug Black

Is there a way to refresh one list item without reloading the entire list? I'm trying to edit variables in one list item, but it is changing all of the values.


Refresh One List Item

Posted: Sun Nov 03, 2013 10:44 am
by Illya Stepanov

Hi Doug,

Can you show the code you tried?


Refresh One List Item

Posted: Sun Nov 03, 2013 10:47 am
by Doug Black

All I had tried at this point was to invoke the service for the list. I just wasn't sure if there was a way to refresh only one DIV or list item. I've looked at some JQuery ways that I will try, but wanted to see if you had some advice for me.

Thanks Illya!


Refresh One List Item

Posted: Sun Nov 03, 2013 10:53 am
by Illya Stepanov

Try something like this: pre$("#list1").listview ("refresh");pre
-- list1 - is your list element you want to refresh./pre/pre


Refresh One List Item

Posted: Sun Nov 03, 2013 11:37 am
by Doug Black

Thanks! I'll try it after the update is over!


Refresh One List Item

Posted: Sun Nov 03, 2013 9:40 pm
by Doug Black

I just tried the code. Didn't work. Any other ideas?


Refresh One List Item

Posted: Mon Nov 04, 2013 12:29 am
by Illya Stepanov

Doug, please can you post some code example that you using now, and what you want to get as a result?


Refresh One List Item

Posted: Mon Nov 04, 2013 1:11 am
by Doug Black

Happy to!

I've created a list that individuals can submit requests to. I want to be able to click a "Like" button to add to a counter for that particular request.
Image

I have the service set up to like the request and add to the counter. However, I want to limit each user to like a request ONLY once (so to avoid spam). The person doesn't register to gain access to the list, and I'm trying to avoid creating another collection to log each click.

So, I want to be able to read when a person clicks the "Like" button. Then, I had thought to write it to a label in the list and change the color of the "Like" button. However, when I had changed values and colors in the list item, nothing happened. Then, if I called the List service, it changed every list item.

I hope this explains it!


Refresh One List Item

Posted: Mon Nov 04, 2013 12:46 pm
by Maryna Brodina

Hello! Could you please post the code you use to change values and color?


Refresh One List Item

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

I did it through events after the click.
Image

Upon "success" of the service, it would:

  1. Change the picture asset via Javascript (example: Appery('picturename').asset('src','URL'),

  2. Change the text of the Notation Label from false to true (true meaning you clicked on it and should not be able to click on it again).

  3. Change the text below it to say Thank you.

  4. Invoked list service.

    Forgive me I don't have actual pictures, as I had to rebuild some it last night. This is how I did it, but I'd like to do it via Javascript.