I wanted to make my tableview a bit more of a grid system, so that two tableviewrow's were side to side per row
----------------------<br > | row 1 | row 2 |<br > | row 3 | row 4 |<br > | row 5 | row 6 |<br > | row 7 | row 8 |<br > ----------------------<br >
Hope this makes sense?
4 Answers
Accepted Answer
It's easy. No webview needed - in fact avoid the webview as much as possible.Take a look at the code below:
var scrollview = Ti.UI.createScrollView({ contentHeight:'auto', layout:'horizontal', width:320, height:320, backgroundColor:'#0ff' }); var lbls = []; for (var i=0; i < 30; i++) { lbls[i] = Ti.UI.createLabel({ width:160, height:50, text:i, borderWidth:1, borderColor:'#555' }); scrollview.add(lbls[i]); }; the_window.add(scrollview);The secret is
layout:'horizontal' to make the cell (in this case the label) to have the width = width_of_the_scrollview/number_of_cells_in_rowOf course you will have to figure out next what the cell is which but is not that hard
I don't know exactly what you have in mind, but:
- This is certainly not trivial if you really want to use a tableView (I tried a few things without any success): at the best you may have to rewrite a good portion of code;
- Maybe a webView with a table would be more appropriate?
What is the reason for the grid? If you just want to put more information on the screen, then a simple tableview with two views added horizontally on each row will do the trick. If there is a reason for each cell to be a unique tableviewrow, you can have 2 tableviews side by side, but they will scroll independently. I'm not sure how difficult it would be to synchronize them.
Hi is possible add a Click eventListener?
Your Answer
Think you can help? Login to answer this question!