ExtJS grid tableGrid study

来源:互联网 发布:js校验18位身份证号 编辑:程序博客网 时间:2024/05/29 15:03

在线学习手册:

http://tool.oschina.net/apidocs/apidoc?api=extjs4.1%2Fdocs%2Findex.html%23!%2Fapi


Q: 

How to color the text in the grid

Try:

http://dev.sencha.com/playpen/docs/output/Ext.grid.TableGrid.html

http://www.iteye.com/problems/19221

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 REvalue = 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>



原创粉丝点击