开发者

Is it possible to add text element in a grid Panel in extjs 2

I want to add a readonly text on the top of a GridPanel. Is it possible in extjs 2?

Something like "Note" in following example

Grid Header

Note: this is information abot grd

srno | name | xxx| yyyyy|zz开发者_运维技巧zzzzz

Thanks, User


The Gridpanel has a 'header' property which reads:

header : Boolean true to create the Panel's header element explicitly, false to skip creating it. If a title is set the header will b... true to create the Panel's header element explicitly, false to skip creating it. If a title is set the header will be created automatically, otherwise it will not. If a title is set but header is explicitly set to false, the header will not be rendered.

Will this do the job?

EDIT as per comment:

Sure, there are examples on the ext.js api site, but it would be something along these lines:

var grid = new Ext.grid.GridPanel({
    //your existing stuff
    width: 600,
    height: 300,
    frame: true,
    title: 'This title will appear accross the header bar'
});

To specify more options for the header than the default classes and using the text from the 'title' property you can configure it like this:

var grid = new Ext.grid.GridPanel({
    //your existing stuff
    width: 600,
    height: 300,
    frame: true,
    headerCfg: {
        tag: 'h2',
        cls: 'x-panel-header',        // or whatever css class you want to apply
        html: 'Some custom text, I assume you can use tags in here'
    },
    headerCssClass = 'anotherClass' //this is additional styling
});

Have a look on the API for gridpanel, then look at the 'bodyCfg' config section, this shows the examples for header and footer. Hope it helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜