开发者

how to set style to grid in extjs

开发者 https://www.devze.com 2022-12-22 03:30 出处:网络
how to开发者_开发技巧 set style to grid so that it display font-family i am tring like this style: {\'font-family\': \'Brush Script MT\',

how to开发者_开发技巧 set style to grid so that it display font-family i am tring like this style: {'font-family': 'Brush Script MT', 'font-weight': 'bold'

} but result does not show according to it.

and i m also trying

style:'font-family:Brush Script MT; font-size:300px', but it also not show the result according to it.. can u pls tell me why?


I am not an expert in ExtJs but one way to do this is to use getRowClass in the GridPanel to define a function that returns a css class.

Something like

var grid = new Ext.grid.GridPanel({
    store:my_store,
    view: new Ext.grid.GridView({
        //forceFit:false,
        enableRowBody:true,
        ignoreAdd: true,
        deferEmptyText: false,
        emptyText: 'No Record found.',
          getRowClass: function(record, rowIndex, rp, ds){ // rp = rowParams
                if(record.get('f_severity') == 'Critical')
                {
                    return 'x-grid3-row red-class';
                }
                  }
        }),
        bbar:pagingBar,
        plugins: filters,
....

In this example, 'red-class' is a custom CSS class.


Font styles are set at the table cell (td) level, so you also have to override them there. Add this to your stylesheet (after the Ext JS stylesheet):

.x-grid3-row td {
    font-family: 'Brush Script MT';
    font-weight: bold;
}

BTW, this is basically a duplicate of your other question. No need to ask multiple times.

0

精彩评论

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

关注公众号