Page 1 of 2

Generate local data and display it in a list.

Posted: Wed Feb 08, 2012 2:22 am
by viyic

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.


Generate local data and display it in a list.

Posted: Wed Feb 08, 2012 2:27 am
by maxkatz

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


Generate local data and display it in a list.

Posted: Wed Feb 08, 2012 2:36 am
by viyic

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.


Generate local data and display it in a list.

Posted: Thu Feb 09, 2012 12:20 am
by maxkatz

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.


Generate local data and display it in a list.

Posted: Thu Feb 09, 2012 1:18 am
by viyic

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 ...


Generate local data and display it in a list.

Posted: Fri Feb 10, 2012 7:18 pm
by maxkatz

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


Generate local data and display it in a list.

Posted: Thu Apr 25, 2013 4:02 pm
by John5766500

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.


Generate local data and display it in a list.

Posted: Thu Apr 25, 2013 4:30 pm
by Kateryna Grynko

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.


Generate local data and display it in a list.

Posted: Thu Apr 25, 2013 4:41 pm
by John5766500

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?


Generate local data and display it in a list.

Posted: Thu Apr 25, 2013 9:02 pm
by Kateryna Grynko

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