2011-05-12 85 views

回答

3

你可以尝试这样的事:

//==== Progress bar 1 ==== 
var pbar1 = new Ext.ProgressBar({ 
    id:'pbar1', 
    width:300 
}); 

var grid = new Ext.grid.PropertyGrid({ 
    title: 'Properties Grid', 
    autoHeight: true, 
    width: 300, 
    renderTo: 'grid-ct', 
    bbar: pbar1, //You can set the progress bar as the property girds bottom toolbar. 
    customRenderers: { 
    Available: function(v){ 
     return '<img src="path to image" />'; 
    } 
    }, //This would render the image into the Available property. 
    source: { 
     "(name)": "My Object", 
     "Created": new Date(Date.parse('10/15/2006')), 
     "Available": false, 
     "Version": .01, 
     "Description": "A test object" 
    } 
}); 

当使用customRenderers要呈现的图像
The name of the renderer type should correspond with the name of the property that it will render更多看到API

+0

嗨感谢您的答复。属性网格中的图像效果很好(在CustomRenders中使c很小)。但是有没有其他方法可以在属性网格中添加进度条?我想将它作为一个值添加。现在,我只是使用图像来充当进度条。 Regards – user427969 2011-05-12 23:17:32

+0

我不知道你实际上将进度条添加到属性网格中的单元格。我不知道你会做到这一点。如果我想到我会在这里发布的东西。 – shane87 2011-05-13 00:01:19

0

这是我的第一件事。但它仍然不如用户友好,因为它在呈现网格之后呈现进度条。

这是自定义渲染你的进度列:

renderer: function(value, metaData, record, rowIndex, colIndex, store) { 
       var id = Ext.id(); 
       (function(){ 
        var progress = new Ext.ProgressBar({ 
         renderTo: id, 
         value: progress_value 
        }); 
       }).defer(25); 
       return '<div id="'+ id + '"></div>'; 
      } 

它使得<div id="generated-id"/>然后呈现进度生成到这个div

最好使用某种闭包来创建进度条一次,并通过自定义渲染器返回它的html,如上例所示,但不幸的是,我不知道如何在Ext.js 3中执行它。至于Ext.js 4你可以看到这个线程在sencha forum