ExtJS -- Grid 文本居中显示

Reference: http://stackoverflow.com/questions/6561120/extjs-4-apply-defaults-to-all-columns-in-a-grid

1 columns: {
2     items:[
3         { header: "ID", dataIndex: "ID"},
4         { header: "Name", dataIndex: "Name"}
5     ],
6     defaults:{    // here, apply default config to each column
7         align: "center"
8     }
9 }

Sencha --   : 

This option is a means of applying default settings to all added items whether added through the items config or via the add or insert methods.

If an added item is a config object, and not an instantiated Component, then the default properties are unconditionally applied. If the added item is an instantiated Component, then the default properties are applied conditionally so as not to override existing properties in the item.

If the defaults option is specified as a function, then the function will be called using this Container as the scope (this reference) and passing the added item as the first parameter. Any resulting object from that call is then applied to the item as default properties. ...

 

posted @ 2013-07-02 22:26  goto13  阅读(927)  评论(0编辑  收藏  举报