-
6 Nov 2011 9:37 PM #1
Answered: How can we manage layout with in dataview ?
Answered: How can we manage layout with in dataview ?
i want to create a data view in which each items come side by side, but when ever i tried using the layout Configs by setting it to hbox, its still coming as a list.
For the below code :
var touchTeam = Ext.create('Ext.DataView', {
fullscreen: true,
layout: 'hbox',
store: {
fields: ['name', 'age'],
data: [
{name: 'Jamie', age: 100},
{name: 'Rob', age: 21},
{name: 'Tommy', age: 24},
{name: 'Jacky', age: 24},
{name: 'Ed', age: 26}
]
},
itemTpl: '{name}'
});
Output is:
Jamie
Rob
Tommy
Jacky
Ed
I want it like:
Jamie Rob Tommy Jacky Ed
Any way to get this work???
-
Best Answer Posted by jay@moduscreate.com
You should set float: left; on the elements. Use CSS to do this

-
7 Nov 2011 8:32 AM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,170
- Vote Rating
- 33
- Answers
- 83
You should set float: left; on the elements. Use CSS to do this


Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
-
7 Nov 2011 9:31 PM #3
-
7 Nov 2011 11:55 PM #4
Paging?
Paging?
Would you be adding paging to your dataview after you get more items on the first page? I've been reading about it in the Ext JS book and Ext JS in action but they seems a bit overkill. See the php script below:
Code:<?php // connect to database $start = ($_REQUEST['start'] != '') ? $_REQUEST['start'] : 0; $limit = ($_REQUEST['limit'] != '') ? $_REQUEST['limit'] : 3; $count_sql = "SELECT * FROM movies"; $sql = $count_sql . " LIMIT ".$start.", ".$limit; $arr = array(); If (!$rs = mysql_query($sql)) { Echo '{success:false}'; }else{ $rs_count = mysql_query($count_sql); $results = mysql_num_rows($rs_count); while($obj = mysql_fetch_object($rs)){ $arr[] = $obj; } Echo '{success:true,results:'.$results.', rows:'.json_encode($arr).'}'; } ?>


Reply With Quote