1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    29
    Vote Rating
    0
    Answers
    1
    arunc is on a distinguished road

      0  

    Question 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???

  2. You should set float: left; on the elements. Use CSS to do this

  3. #2
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,170
    Vote Rating
    33
    Answers
    83
    jay@moduscreate.com is just really nice jay@moduscreate.com is just really nice jay@moduscreate.com is just really nice jay@moduscreate.com is just really nice

      0  

    Default


    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.

  4. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    29
    Vote Rating
    0
    Answers
    1
    arunc is on a distinguished road

      0  

    Default


    Quote Originally Posted by jgarcia@tdg-i.com View Post
    You should set float: left; on the elements. Use CSS to do this
    that works .....thank you ...
    i just added white-space:nowrap on the parent element it made every thing fine .
    So what is the use of layout config in dataview component???

  5. #4
    Sencha User
    Join Date
    Aug 2011
    Location
    London
    Posts
    341
    Vote Rating
    10
    Answers
    10
    digeridoopoo will become famous soon enough

      0  

    Default 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).'}';
    } ?>