Note that there are some explanatory texts on larger screens.

plurals
  1. POTitanium Studio
    primarykey
    data
    text
    <p>I have set up my table and rows to pull JSON data from my online database, but the problem is that I have paginated data. While my data shows up for the first page, I am unsure of how to set up my JSON pull so it will pull the JSON data from other paginated pages, especially if more pages are dynamically created. i.e. page=4, page=5. Example:</p> <p>Data being pulled currently - </p> <p>First page - <a href="http://testsite.com/data.json" rel="nofollow">http://testsite.com/data.json</a></p> <p>Paginated page (1) - <a href="http://testsite.com/data.json?page=2" rel="nofollow">http://testsite.com/data.json?page=2</a></p> <p>Paginated page (2) - <a href="http://testsite.com/data.json?page=3" rel="nofollow">http://testsite.com/data.json?page=3</a></p> <p>etc. Here is how my code is currently set up:</p> <pre><code> var win = Ti.UI.currentWindow; var data = [], Detail = require('detail'); var barList = Titanium.UI.createTableView({ height: 366, width: 320, top: 0, left: 0 }); win.add(barList); barList.addEventListener('click', function (e) { Ti.API.info('data: ' + JSON.stringify(e.rowData.data)); var detail = new Detail(e.rowData.data); detail.open({modal:true}); }); var xhr = Titanium.Network.createHTTPClient(); xhr.onload = function () { var json = JSON.parse(this.responseText); Ti.API.info(json.length); for (var i = 0; i &lt; json.length; i++) { var row = Titanium.UI.createTableViewRow({ className: 'bar-row', data: json[i].bar, hasChild: true, filter: json[i].bar.name }); var titleLabel = Titanium.UI.createLabel({ text: json[i].bar.name, font: { fontSize: 14, fontWeight: 'bold' }, left: 70, top: 5, height: 20, width: 210 }); row.add(titleLabel); data.push(row); } barList.setData(data); }; xhr.open('GET', 'http://testsite.com/data.json'); xhr.send(); win.open(); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload