1

I using extjs and i want display my dynamic data like bellow enter image description here

I use xtype: displayfield but i think it's not well and i can't use it to make like my picture

items: [

    {
            xtype: 'displayfield',
            style: 'border: 1px solid #CCCCCC', 
            fieldLabel: 'a',
            name: 'a',
            value: 'a'
        }, {
            xtype: 'displayfield',
            style: 'border: 1px solid #CCCCCC', 
            fieldLabel: 'b',
            name: 'b',
            value: 'b'
    }],

any idea? How to do that thanks

DeLe
  • 2,442
  • 19
  • 88
  • 133

1 Answers1

2

For such a complex layout, and considering you apparently just need to display data, I'd go with a component with a custom template. This way, you can leverage HTML & CSS for presentation.

Here's, for example, how to make a reusable panel:

Ext.define('My.BudgetPanel', {
    extend: 'Ext.Panel'

    ,tpl: '<table>'
        // notice template variables
        + '<tr><td>{definedProject}</td><td>{definedPM}</td></tr>'
        + '</table>'
});

You can pass it your data at creation:

var panel = Ext.create('My.BudgetPanel', {
    data: {
        definedProject: 'My Project'
        ,definedPM: 'Foo Bar'
    }
});

And you can update with new data later:

panel.update({definedProject: 'My Project 2', definedPM: 'Baz Bat'});
rixo
  • 23,815
  • 4
  • 63
  • 68
  • I try that but when i break line I must using + operator :(. example my below code will not working. ' // break line here // break line here
    // break line here '
    – DeLe Jun 21 '13 at 03:39
  • 1
    No HEREDOC in Javascript :-( Maybe this [other question](http://stackoverflow.com/q/805107/1387519) can help... – rixo Jun 21 '13 at 12:18