EasyUI Forum
April 19, 2024, 04:09:59 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: datagrid field formatter  (Read 7859 times)
mygod
Newbie
*
Posts: 10


View Profile Email
« 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?
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 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'));
}
Logged
mygod
Newbie
*
Posts: 10


View Profile Email
« Reply #2 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'));
« Last Edit: March 23, 2017, 06:17:57 PM by mygod » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!