Ram
Posts: 0
Joined: Fri Aug 02, 2013 12:15 pm

clear some list entries, what is the best approach?

Dear Appery,

i'm using PhoneGap to read contact list, some of the name entries are empty:

Image

my question is what is the best approach to get to a list that holds only records with names in it, should i use contact filter while loading the records into the list? or should i loop through the list on success event and delete the list items that holds "null" value?

Thx much in advance!
Best,
R.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

clear some list entries, what is the best approach?

Probably a filter that ignores empty contacts is better.

Ram
Posts: 0
Joined: Fri Aug 02, 2013 12:15 pm

clear some list entries, what is the best approach?

thx max, i'll give it a try, BTW, is there a way to read the contacts into local storage and use echo from now on?

Ram
Posts: 0
Joined: Fri Aug 02, 2013 12:15 pm

clear some list entries, what is the best approach?

cool, here's what i did so far:

  1. on success i saved the contacts to local storage

  2. i copied the JSON from the device local storage

  3. i created a new service and build a response by using the JSON from step 2

    now, my question is regard the "Request", should i use the same request structure as the Contact service?

    Image

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

clear some list entries, what is the best approach?

If you create new service and going to use as a service which returns echo value, you don't need request parameters in this service at all.

Ram
Posts: 0
Joined: Fri Aug 02, 2013 12:15 pm

clear some list entries, what is the best approach?

got it, so how do i query the data? by looping the local storage? or there's another way?

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

clear some list entries, what is the best approach?

Before preservice_name.__requestOptions.echo = '.....';/preyou can query data the way you need.

Ram
Posts: 0
Joined: Fri Aug 02, 2013 12:15 pm

clear some list entries, what is the best approach?

ok, got it to work just to realize that performance wise there's no change between reading all contacts from the iDevice or reading them from local storage...

is there any way to keep the page with the contact list in memory once it has been populated with all the user contacts? that way the user will not have to wait every time he looks for a contact information for the list to re populate all over again with all of his contacts.

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

clear some list entries, what is the best approach?

Hi Ram,

Yes, use localStorage to do this.

Return to “Issues”