viyic
Posts: 0
Joined: Wed Feb 08, 2012 2:22 am

Generate local data and display it in a list.

Thank you for your attention.

My questions are:
How I can do what is done in this tutorial but in local storage?
http://help.gotiggr.com/getting-start...

One example of this, or a demo.

He commented that I searched all day but this information does not exist!

What I'm trying to do is download an application that records a list of web service and save it locally, then display the records (not online) lists ... but I could not do it.

How to fill a grid with a list of local data?

How to create local data and display it in a list?

I hope I understand, my English is not very good.

Thank you.

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

Generate local data and display it in a list.

Sure, this is possible but you would need to create the data model manually in JavaScript.

viyic
Posts: 0
Joined: Wed Feb 08, 2012 2:22 am

Generate local data and display it in a list.

Thanks for answering Max.

Could you give me some reference to investigate?
I get tired of looking and do not see how

I'ma developer, but JavaScript I know very little ...

Also as might contact you privately to request a quote for services development.

Approximately what services would cost to create this functionality?

Thanks again.

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

Generate local data and display it in a list.

Check out our Local Storage tutorial, it will give you a good idea how to store data in browser: http://help.tiggzi.com/getting-started

[quote:]
Approximately what services would cost to create this functionality?
[/quote]
We can definitely help but would need more information on what you are trying to build. Feel free to send me an email to max at exadel dot com.

viyic
Posts: 0
Joined: Wed Feb 08, 2012 2:22 am

Generate local data and display it in a list.

One example of how to save the response WS, and display the later (offline) on a grid?

In a local variable I can save a list I downloaded from the internet? not only a record, but a list of multiple rows of data ...

And then as the show in a list? (offline)

Thanks for your attention.

Note: I did all the tutorials ...

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

Generate local data and display it in a list.

Here is a sample app that stores Twitter trends in Local Storage: http://tiggzi.com/preview/27076/

This code does all the work, it looks long but actually pretty simple:
code
function refreshList(){

var tdDiv = $('[dsid=list] td div:first');
var nodeDiv = tdDiv.find('div[name=nodeTemplateLabel]');
var itemDiv = tdDiv.find('div[name=itemTemplateLabel]');

tdDiv.html('').append(nodeDiv).append(itemDiv);

var data = localStorage.getItem('trends');

Code: Select all

 if(data=='undefined'||data==null){ 

return;
}

try{
var json = JSON.parse(data);
} catch(err){
return;
}

var n = 1;
$.each(json.trends, function(nodeLevel1, valLavel1){

var newNodeDiv = nodeDiv.clone(true);
updateDiv(newNodeDiv, nodeLevel1);
n++;

$.each(valLavel1, function(nodeLevel2, valLevel2){
var newItemDiv = itemDiv.clone(true);
updateDiv(newItemDiv, valLevel2.name);
n++;
});

});

updateDiv: function updateDiv(div, text){
div.css('display', 'block');
div.attr('name', 'newLabel');
div.attr('id', div.attr('id') + '_' + n);
div.attr('dsid', 'mobilelabel');
div.text(text);
tdDiv.append(div);
}
}

function setStatus(text){
$('[name=status]').text('Status: ' + text);
}
/code

John5766500
Posts: 0
Joined: Wed Apr 17, 2013 2:07 pm

Generate local data and display it in a list.

Following this example and I'm getting a page not found on the link http://tiggzi.com/preview/27076/ - could you please point me to the correct link.

thanks.

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

Generate local data and display it in a list.

Hi John,

This is an old link. Try: http://appery.io/app/preview/a4b46eca...
Unfortunately, "Fill Storage" button won't work now because Twitter changed the conditions for using the service.

John5766500
Posts: 0
Joined: Wed Apr 17, 2013 2:07 pm

Generate local data and display it in a list.

thanks - I was hoping seeing the code would help ;)

I have a JSON array which I'm building locally and I want to populate a list with this data. All makes sense up to the updateDiv part of the example.

Have you any other examples of doing this?

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

Generate local data and display it in a list.

Hi John,

Here is an example of creating List from array:
codevar data = ["Tinker", "Tailor", "Solder", "Spy"];
var listHtml = '<ul data-role="listview">';

for(var i=0; i<data&#46;length; i++)
{
listHtml += '<li><a href="#">'+data+'<&#47;a><&#47;li>';
}
listHtml += '<&#47;ul>';
var listElement = $(listHtml);
Appery('mobilecontainer1')&#46;append(listElement);
listElement&#46;listview();/code

Return to “Issues”