Results 1 to 3 of 3

Thread: DataView works on it's own in fullscreen mode but not inside a Panel

  1. #1
    Sencha User
    Join Date
    Nov 2011
    Location
    Switzerland
    Posts
    6
    Vote Rating
    0
      0  

    Question DataView works on it's own in fullscreen mode but not inside a Panel

    Just trying to understand DataViews - they only seem to work as fullscreen items and not embedded anywhere (Chrome 15).

    The documentation example here shows a DataView in fullscreen mode and it works for me - I get a list:
    Code:
    Ext.setup({ onReady: function(){
     
      var obj1 = new Ext.Panel({
       html: '© Marc Cawood 2011',
      });
    
    
     var obj2 = Ext.create('Ext.DataView', {
        fullscreen: true,
        store: {
            fields: ['name', 'age'],
            data: [
                {name: 'Jamie',  age: 100},
                {name: 'Rob',   age: 21}
            ]
        },
        itemTpl: '<div>{name} is {age} years old</div>'
     });
     } // onReady
    
    
    });
    If I remove the fullscreen attribute and embed it in one of my panels it doesn't work at all - blank panel:
    Code:
    Ext.setup({ onReady: function(){
     
      var obj1 = new Ext.Panel({
       html: '&copy; Test 2011',
      });
    
     var obj2 = Ext.create('Ext.DataView', {
        //fullscreen: true,
        store: {
            fields: ['name', 'age'],
            data: [
                {name: 'Jamie',  age: 100},
                {name: 'Rob',   age: 21}
            ]
        },
        itemTpl: '<div>{name} is {age} years old</div>'
     });
    
      Ext.create('Ext.Container', {
       fullscreen: true,
       layout: 'hbox',
       items: [obj2]
       });
    
    
     } // onReady
    
    
    });
    Now, if I change this line:
    Code:
       items: [obj2]
    to
    Code:
       items: [obj1]
    It works as expected, my footer obj1 "Test 2011" is displayed. So it looks like obj2 (i.e. DataView) is not embeddable??

  2. #2
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,060
    Answers
    3976
    Vote Rating
    1389
      0  

    Default

    You are using HBox layout so if you specify the flex or width property on the DataView that is embedded into the fullscreen Container, it should work. Just right now there is no width so it's zero pixels wide.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Nov 2011
    Location
    Switzerland
    Posts
    6
    Vote Rating
    0
      0  

    Default OK

    Thanks. setting flex or width works. It's not very logical to me why normal HTML sizes to fit whilst the DataView defaults to 0px but I'm new to this stuff. However I wonder where you see 0px: when I inspect my DOM (without specifying width or flex) I find my data inside a 47px wide (though still empty) div....

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •