Results 1 to 5 of 5

Thread: <table> in DataView

  1. #1
    Sencha User dobie_'s Avatar
    Join Date
    Sep 2011
    Location
    Seattle, WA
    Posts
    47

    Default <table> in DataView

    Say I have a DataView like this...
    Code:
    Ext.create('Ext.DataView', {
      id: 'myData',
      itemTpl: '<tr class="dataRow"><td>{someData}</td></tr>',
      store: someStore
    });
    I'd like to put my data in table rows like this. How would I prepend and append the <table> and </table> tags to this component?

  2. #2
    Sencha User
    Join Date
    Jun 2011
    Posts
    42

    Default

    I'm not sure if you can prepend/append the "<table>" tags.

    If it's a viable option, you could try and put the table tags in each itemtpl and then set the width of each cell to a static width size. Obviously, this isn't ideal. but if all else fails you could try this.

  3. #3
    Sencha User dobie_'s Avatar
    Join Date
    Sep 2011
    Location
    Seattle, WA
    Posts
    47

    Default

    Hey anthoang,
    I ended up doing what you suggested -- making each row a separate table. It works out just fine . The DOM is slightly bigger but whatever.

  4. #4
    Sencha User
    Join Date
    Jan 2012
    Location
    Mumbai
    Posts
    36

    Default

    Even i'm trying to achieve the same thing as dobie,
    is there any alternative to this found?
    What can i do to add table header row above our dataview?

    Thanks,
    mrunal

  5. #5
    Sencha User kostysh's Avatar
    Join Date
    Nov 2011
    Location
    Odessa, Ukraine
    Posts
    176

    Default

    maybe something like this:
    Code:
    Ext.create('Ext.Container', {
      items: [{
        xtype: 'table',
        items: [
          xtype: 'dataview',
          id: 'myData',
          itemTpl: '<tr class="dataRow"><td>{someData}</td></tr>',
          store: someStore
        ]
      }]
    });
    or you can use Component DataView and create custom table component with dataview ability

    Read about Component DataView here: http://docs.sencha.com/touch/2-0/#!/guide/dataview

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
  •