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

给Extjs grid中的列自定义渲染方式

给grid中其中网址的那一列,加上超链接,使之点击即可进入。

看代码:

 
function showUrl(value)
{
    return"<a href="+value+">"+value+"</a>";
}
Ext.onReady(function(){
    var data=[
        {id:1,name:'EasyJWeb',organization:'EasyJf',homepage:'www.Easyjf.com'},
        {id:2,name:'jfox',organization:'huihoo',homepage:'www.huihoo.com'},
        {id:3,name:'jdon',organization:'jdo',homepage:'www.jdon.com'},
        {id:4,name:'springside',organization:'springside',homepage:'www.springside.com'}
        ];
    var store =new Ext.data.JsonStore(
        {
            data:data,
            fields:['id','name','organization','homepage']
        }  
    );
    var colM =new Ext.grid.ColumnModel(
        [
            {header:'项目名称',dataIndex:'name',sortable:true},
            {header:'开发团队',datIndex:'organization',sortable:true},
            {header:'网址',dataIndex:'homepage',renderer:showUrl}
            ]  
    );
    var grid =new Ext.grid.GridPanel({
        renderTo:'hello',
        title:'中国java开源产品及团队',
        height:200,
        width:600,
        cm:colM,
        store:store,
        autoExpandColumn:2
    });
     
    });

作者:howlaa
 

 


补充:web前端 , JavaScript ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,