ExtJs的问题

zhaorongrong 2011-10-25 02:01:20
我现在初学ExtJs,查看各种小例子和API的时候发现一个很奇怪的问题,希望各位大侠能指教一二
var grid = new Ext.grid.GridPanel({
store: new Ext.data.Store({
reader: reader,
data: xg.dummyData
}),
columns: [
{id:'company', header: "Company", width: 200, sortable: true, dataIndex: 'company'},
{header: "Price", width: 120, sortable: true, renderer: Ext.util.Format.usMoney, dataIndex: 'price'},
{header: "Change", width: 120, sortable: true, dataIndex: 'change'},
{header: "% Change", width: 120, sortable: true, dataIndex: 'pctChange'},
{header: "Last Updated", width: 135, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
],
viewConfig: {
forceFit: true,

// Return CSS class to apply to rows depending upon data values
getRowClass: function(record, index) {
var c = record.get('change');
if (c < 0) {
return 'price-fall';
} else if (c > 0) {
return 'price-rise';
}
}
},
sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
width:600,
height:300,
frame:true,
title:'Framed with Checkbox Selection and Horizontal Scrolling',
iconCls:'icon-grid'
});

这个例子是ExtJs3.3 API的Ext.grid.GridPanel上面给的一个例子。其中viewConfig指的应该就是Ext.grid.GridView类了,可是这个类中没有上面程序中提到的 getRowClass属性啊。这让我很奇怪。因为我看的其他例子中也有很多用到的属性是我在API中差不到的,具体原因求赐教。。
...全文
121 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
leehuat 2011-11-02
  • 打赏
  • 举报
回复

viewConfig 这里面的配置其实应用到
Ext.grid.GridView
当你设置forceFit:ture
或者默认时候, GridView会对column进行处理的
天下有雪 2011-11-01
  • 打赏
  • 举报
回复
4.0版以上,变化不小。还是看最新的版本吧。
zhaorongrong 2011-11-01
  • 打赏
  • 举报
回复
我不明白二楼的意思呢,我看的api啊
leehuat 2011-10-28
  • 打赏
  • 举报
回复

viewConfig : Object

A config object that will be applied to the grid's UI view. Any of the config options available for Ext.grid.GridView can be specified here. This option is ignored if view is specified.
一品 2011-10-25
  • 打赏
  • 举报
回复
你看的是api还是帮助文档呢?

Ext.grid.GridView = Ext.extend(Ext.util.Observable, {
<div id="method-Ext.grid.GridView-getRowClass"></div>/**
* Override this function to apply custom CSS classes to rows during rendering. You can also supply custom
* parameters to the row template for the current row to customize how it is rendered using the <b>rowParams</b>
* parameter. This function should return the CSS class name (or empty string '' for none) that will be added
* to the row's wrapping div. To apply multiple class names, simply return them space-delimited within the string
* (e.g., 'my-class another-class'). Example usage:
<pre><code>
viewConfig: {
forceFit: true,
showPreview: true, // custom property
enableRowBody: true, // required to create a second, full-width row to show expanded Record data
getRowClass: function(record, rowIndex, rp, ds){ // rp = rowParams
if(this.showPreview){
rp.body = '<p>'+record.data.excerpt+'</p>';
return 'x-grid3-row-expanded';
}
return 'x-grid3-row-collapsed';
}
},

52,797

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ajax
社区管理员
  • Ajax
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧