Colten Tenney
Posts: 0
Joined: Thu Sep 25, 2014 3:41 am

How to select list items made by database

Quick question, but how does one click a database populated list item and have it perform an action? For example if I made a list and looped the database entry array onto it (as commonly done in tutorial videos), and I want to delete an item from that list/database right from the app by simply clicking on it, how is it handled?

Seems like it's something so simple that I haven't been able to figure out.

She
Posts: 0
Joined: Wed Oct 08, 2014 12:46 am

How to select list items made by database

Hi Colten,

I hope these links will help you:

http://devcenter.appery.io/documentat...

http://devcenter.appery.io/tutorials/...

http://devcenter.appery.io/tutorials/...

after you read the documentations about database, you can do it by some logics in click event of a listview and mapping of a service

Regards

Colten Tenney
Posts: 0
Joined: Thu Sep 25, 2014 3:41 am

How to select list items made by database

Thanks for the pointers.

I understand the "Building a clickable list app with HTML5 local storage" tutorial, but that is for a static list. How could I modify that tutorial for a list that is dynamic (with a variable length and values)? The tutorial uses a tagID, and each entry has a tag parameter. I think in my case the tags (ids) would be constantly changing due to the dynamic nature of the database collection/list.

This really can't be that difficult to implement. There's a lot of tutorials on how to add entries to collections/lists from within an app, but I have yet to find any that also have a delete feature.

Colten Tenney
Posts: 0
Joined: Thu Sep 25, 2014 3:41 am

How to select list items made by database

I just found this tutorial
http://devcenter.appery.io/tutorials/...

I will analyze it and post back here when I reach a conclusion.

Colten Tenney
Posts: 0
Joined: Thu Sep 25, 2014 3:41 am

How to select list items made by database

I got the basics down. I was going wrong when I wasn't binding variables to components.

So I have a simple "click on list item item is deleted" functionality. Now what I want is to have the ability to select multiple items that I want deleted and invoke the delete service once to delete all selected items. I have no idea how to use the array workaround for local storage variables, and I think that's what I need.

She
Posts: 0
Joined: Wed Oct 08, 2014 12:46 am

How to select list items made by database

Hi Colten,

array work in localStorage, I dont even know that, i think the support will help you about that, i will follow this post so i can get ideas too.

Thank you,

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

How to select list items made by database

Hello!

Your situation is totally described in this part of tutorial http://devcenter.appery.io/tutorials/...

Colten Tenney
Posts: 0
Joined: Thu Sep 25, 2014 3:41 am

How to select list items made by database

So in order to get the complete functionality I want, I have made my list component into a checkbox component. It functions the same way as before but also has the selectable function that I need. I want to select entries that I want to delete ( have them be checked) and then press a delete button that will get all the _ids from the hidden labels on each checkbox item and delete it from the database. This is opposed to invoking the service multiple times when it need only be invoked once.

I think I am close to a solution but my javascript is a little off I think. I have a local storage array "_deleteID" that I want to send the _id's of the selected to, and then use those _ids to pass to the delete service. But all the _ids that get sent to the array are of the first element in the checkbox group. Can anyone help? I think just one line of javascript is off.
Image Image

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

How to select list items made by database

Colten,

Please learn http://api.jquery.com/each/ more carefully. You have to use index parameter in your each function or $(this) to identify each element of array

Colten Tenney
Posts: 0
Joined: Thu Sep 25, 2014 3:41 am

How to select list items made by database

Thanks. I couldn't figure out how to get the value from the hidden label so I just binded the _id straight to the value of the checkbox via mapping and used $(this).val() to get it properly.

Return to “Issues”