Below code is for pagination but am getting the old page rows also appended to new page....

You must Login before you can answer or comment on any questions.

this code is for pagination but am getting the old page rows also appended to new page....PLease can anyone explain me how to do pagination with tableviews

I have just included the necessary code in the post as the whole code is lengthy for you to read

//creates a new table and I want to delete the first row of old table function setData(l) { table.deleteRow(0); table = Ti.UI.createTableView({ top:50, search:search, searchHidden:true, showCancel:true, }); win.add(table); table.addEventListener('click', function(e){ table.deleteRow(0); var index = e.index; var section = e.section;

var row = e.row;

var rowdata = e.rowData;

var wind = Titanium.UI.createWindow({

url:"eventdetails.js",

title:"Session Details",

});

wind.EventID = row.pathid;

wind.totDateTime = rowdata.totDateTime;

wind.confID = ConferenceID;

Titanium.UI.currentTab.open(wind,{animated:true}); });

}

//code for next previous buttons and a label b/w them

var b1 = Ti.UI.createButton({

title:'aa',

top:10,

left:10,

width:50,

height:30,

color:'#fff',

backgroundColor:''

});

win.add(b1);

b1.addEventListener('click', function(){

setData(l=l-1);

});

var dateLabel = Ti.UI.createLabel({

top:0,

left:0,

width:320,

height:'50',

textAlign:'center',

text:'',

color:'#fff',

backgroundColor:''

});

win.add(dateLabel);

var b2 = Ti.UI.createButton({

title:'Next',

top:10,

right:10,

width:50,

height:30,

color:'#fff',

backgroundColor:''

});

win.add(b2);

b2.addEventListener('click', function(){

win.remove(table);

setData(l=l+1);

});

please do reply for this post....

1 Answer

hi Sukesh,

but what is the need to open a new window everytime on the next and previous button click...?

you can do one thing open a table only one time in the same window and delete the row from table or you can use property table.data =[]; to blank the table... and set a new row by calling setData() function

Your Answer

Think you can help? Login to answer this question!