EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: mygod on March 20, 2017, 01:37:48 AM



Title: datagrid field formatter
Post by: mygod on March 20, 2017, 01:37:48 AM
sorry ,I Only know a little bit of English,
then I used google translation。
grid = $('#dg').datagrid({
        rownumbers: true,
        singleSelect: true,
        autoRowHeight: true,
        pagination: true,
        idField: 'ID',
        fit: true,
        url: contextPath + '/service/yw/Handler_user.ashx',    
        pageSize: 15,
        pageList: [15, 20, 30],
        fitColumns: true,
        columns: [[
            { field: 'IDENTITYCARD', title: '员工编号', width: 100 },
                { field: 'action', title: '操作', width: 150, align: 'center', formatter: check_action }
        ]]
    });
function pagerFilter(data) {
return '<a href="#" id="first" class="easyui-linkbutton" >modi</a> ';
}

The easyui-linkbutton style No  applied。

It Can be achieved by the following method:
onLoadSuccess(data)
{
$('#first').linkbutton();
}


Now i used the next code :

var datagrid_render = $.fn.datagrid.defaults.view.render;
$.extend($.fn.datagrid.defaults.view, {
    render: function (target, container, frozen) {
        datagrid_render.call(this, target, container, frozen);  
        var ddd = $(target).find("td[field]");
        $.parser.parse(ddd);
    }
});

Whether there are plans to directly support this feature?


Title: Re: datagrid field formatter
Post by: jarry on March 20, 2017, 08:10:48 AM
Please use this code to parse the components after loading the data successfully.
Code:
onLoadSuccess: function(){
$.parser.parse($(this).datagrid('getPanel'));
}


Title: Re: datagrid field formatter
Post by: mygod on March 23, 2017, 06:00:05 PM
This is not very convenient.

Although the following method can be used
$.extend($.fn.datagrid.methods, {
   onLoadSuccess: function(){
   $.parser.parse($(this).datagrid('getPanel'));
}
});


But some datagrid onloadsucess events need to  rewrite

The following code must be added in onLoadSuccess event again
$.parser.parse($(this).datagrid('getPanel'));