【问题标题】:How can I creat a bar in a cell of a Grid (ExtJS 3.3.1)如何在网格的单元格中创建一个栏(ExtJS 3.3.1)
【发布时间】:2012-01-18 22:46:51
【问题描述】:

我有一个具有关联 JsonStore 的网格,并且一切都很好。我想在这样的列中创建:

我对 Ext 很陌生,但这是我目前在 ColumnModel 中所拥有的:

     {
        header: 'Sales Rep', 
        width: 150, 
        sortable: true, 
        dataIndex: 'salesrep'
     },
     {
        header: 'graph',
        width: 150,          
        sortable: true, 
        dataIndex: 'ytd',
        renderer: function(value, metaData, record, rowIndex, colIndex, store){
            var colChart = new Ext.chart.ColumnChart({
                store: store,
                xField: 'ytd',
                yField: 'salesrep'           
            });             
        }            
     },
     {
        header: 'Year to Date', 
        width: 150, 
        sortable: true, 
        dataIndex: 'ytd'
     }, 

第一列和第三列按预期工作,但我在第二列中看不到任何内容。有人做过这样的事吗?

【问题讨论】:

    标签: extjs extjs3


    【解决方案1】:

    使用列渲染器,您可以通过metadata 对象影响渲染。

    不幸的是,它只允许更改 html 属性和 css 类。
    因此,您要么需要尝试使用 css 样式生成图表,要么搜索其他可能的方式,例如创建临时列。

    【讨论】:

    • 好的,我现在在 setRenderer 方法的定义中看到了。所以,基本上我需要使用 HTML 和 CSS 来创建条形外观。我能做到。不过,我喜欢条形图的活泼动画 :) 谢谢。
    猜你喜欢
    • 2015-02-20
    • 1970-01-01
    • 2011-01-22
    • 1970-01-01
    • 1970-01-01
    • 2014-07-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多