本帖最后由 kong19 于 2010-07-20 13:16:06 编辑

解决方案 »

  1.   

    上一贴中我把
    grid.render=function(data, metadata, record, rowIndex, columnIndex, store) {
                  if(条件){
                   //这里可以根据rowIndex,columnIndex 设置字体颜色
                    return '<span style="color:red;"><B>' + record.data["Number"] + '</B></span>';
                } else {
                    return record.data["Number"];
                }
            }
    但是执行的时候后面的四个参数都是null,~  
    不知道是不是我上面的代码抄的不对~~~
    combo用同样方法应该也可以实现颜色的设置吧?
      

  2.   


    var s = new Ext.form.ComboBox({
    renderTo: Ext.getBody(),
    mode: 'local',
    editable:false,
       width: 120,   
       triggerAction: 'all',
       displayField:'displayText',
       valueField: 'value', 
    store: new Ext.data.SimpleStore({
       fields : ['displayText','value' ],
       data : [[ '红','red'], ['蓝', 'blue']]
       }),
       listeners: {
       change: function (c) {
       c.getEl().dom.style.color = c.value;
                                                    //在这个事件中做其他的操作,如改变颜色
       }
       }
    });
      

  3.   

    这个要设置在header的选项中
    cm:[{
       header: 'head', 
       dataIndex: "tou",
       renderer: function(data, metadata, record, rowIndex, columnIndex, store) {
                  if(条件){
       ....
    }]
      

  4.   

    grid.render=function(data, metadata, record, rowIndex, columnIndex, store) 
    写成这样肯定后面的参数都null了。这样写你要把这几个参数传过来,你 直接写在列中。
      

  5.   

    我定义的combobox, 可是change事件没有被调用阿~~inputFileType = new Ext.form.ComboBox( {
    id : myid,
    fieldLabel : colItem.displayName,
    store : arStore,
    editable : false,
    displayOrder : colItem.displayOrder,
    typeAhead : true,
    forceSelection : true,
    triggerAction : "all",
    emptyText : "",
    selectOnFocus : true,
    itemCls : 'required',
    labelStyle : 'font-weight:bold;' + WWUJ.Fw.Comp
    .getLabelStyle(WWUJ.Fw.Const.EDITCD_REQUIRED),
    width : 260,
    listeners : {
    'select' : function(obj, value) {
    ... },
    'change': function (c) {
                               c.getEl().dom.style.color = c.value;
                               alert(c.value);
                        } } });
      

  6.   

    而且style设定的颜色,是选完之后的字体颜色,~  
    我想设定的是,点击选择下拉框时,所有项目,根据条件不同,显示出不同的颜色~
      

  7.   

     this.tf_customer_level_color = new Ext.form.ComboBox({// 定义组合框中显示的数据源
    xtype : 'combo',
    mode : 'local',
    triggerAction : 'all',
        forceSelection : true,
    fieldLabel : '选择颜色',
    labelStyle : 'text-align:right',
    width : 200,
    store : new Ext.data.SimpleStore({
            fields : ['value', 'customer_level_color'],
           // data : [['value','<div style="background-color:'+ 'value"' + '>&nbsp;</div>']]
    data : [['white', '<div style="background-color:white">&nbsp;</div>'],
    ['red', '<div style="background-color:red">&nbsp;</div>'],
    ['green', '<div style="background-color:green">&nbsp;</div>'],
    ['blue', '<div style="background-color:blue">&nbsp;</div>'],
    ['yellow', '<div style="background-color:yellow">&nbsp;</div>'],
    ['purple', '<div style="background-color:purple">&nbsp;</div>'],
    ['pink', '<div style="background-color:pink">&nbsp;</div>'],
    ['slateblue', '<div style="background-color:slateblue">&nbsp;</div>'],
    ['saddlebrown', '<div style="background-color:saddlebrown">&nbsp;</div>'],
    ['slategray', '<div style="background-color:slategray">&nbsp;</div>'],
    ['yellowgreen', '<div style="background-color:yellowgreen">&nbsp;</div>'],
    ['navy', '<div style="background-color:navy">&nbsp;</div>'],
    ['brown', '<div style="background-color:brown">&nbsp;</div>']]

    }),
    valueField : 'value',
    displayField : 'customer_level_color',
    allowBlank : false,
    value : '',  
    name : 'customer_level_color'
    });