00039-layui table unit plus hyperlink function

One of the columns:

{field:'companyName', title: '公司名称', align: 'center',minWidth:200,templet:tplCompanyName }

Template method:

var tplCompanyName = function (d) {
            var html = '<a style="color:#1E9FFF" href="javascript:void(0);" lay-event="showRec" >'+d.companyName+'</a>';
            return html;
        }

Event monitoring:

table.on('tool(myOrdersListTable)', function(obj){
            switch(obj.event){
                case 'showRec':
                    active.showRec(obj);
                    break;
            }
        });

Then define active.showRec(obj);

var active = {
    showRec:function(obj){
        //...do your things
    }
}

Guess you like

Origin blog.51cto.com/14816966/2535670