当前位置:编程学习 > JS >>

ExtJS grid tableGrid study

A:
--Latest--
发觉下面不对啊。无法在grid完全加载之后调用“redIt”代码。尝试使用setTimeout(function, 10000),但要间隔10s才能turn to red...
最后发现renderer函数!我是ExtJS菜鸟请见谅。我只想对第六列使用renderer,有谁可以帮忙解决?
 
var grid= new Ext.grid.TableGrid("tableId",{//使用Extjs表格显示数据  
          remove:false,  
          columns:[  
                    {dataIndex: "tcol-0"},  
                    {dataIndex: "tcol-1"},  
                    {dataIndex: "tcol-2"},  
                    {dataIndex: "tcol-3"},  
                    {dataIndex: "tcol-4"},  
                    {dataIndex: "tcol-5",  
                     renderer: function(value, columnIndex){  
                            value = value.replace(/【/g,'<span style="color:red">【');// /【/g RE  
                            value = value.replace(/】/g,'】</span>');//高亮“内容”某些字体为红色  
                            return value;  
                        }  
                    }  
                    ]  
          });  

 

 
 
 
--Previous 30Oct2013--
http://www.w3school.com.cn/tiy/t.asp?f=jquery_selector_class
 
<html>  
<head>  
<script type="text/javascript" src="/jquery/jquery.js"></script>  
<script type="text/javascript">   
   
$(document).ready(function(){  
    $(".intro").css("background-color","#B2E0FF");  
    var t = $(".intro").html();//alert(t);  
    var i = t.indexOf('is');//alert(i);  
    if(i!=0){  
        t = t.replace('is','<font color="red">is</font>');alert(t);  
        $(".intro").html(t);  
    }  
});  
   
</script>   
   
</head>  
<body>  
<html>  
<body>  
<h1>Welcome to My Homepage</h1>  
<p class="intro">My name is Donald</p>  
<p>I live in Duckburg</p>  
<p>My best friend is Mickey</p>  
<div id="choose">  
Who is your favourite:  
<ul>  
<li>Goofy</li>  
<li>Mickey</li>  
<li>Pluto</li>  
</ul>  
</div>  
</body>  
</html>  
   
   
</body>  
</html>  

 

 
补充:web前端 , JavaScript ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,