EasyUI Forum
September 14, 2025, 09:27:53 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 formatter problem 1.4.3  (Read 11898 times)
mazvv
Newbie
*
Posts: 20


View Profile WWW
« on: July 05, 2015, 09:24:24 AM »

Hello.
After update from 1.4.2 to 1.4.3 formatter and styler function for datagrid does not work.
Code:
        <thead>
            <th data-options="field:'status',sortable:false,width:60,formatter:function(value, row, index){return status_formatter(value);}">${_(u"status")}</th>
            <th data-options="field:'modifydt',sortable:true,width:120,styler:function(){return datagrid_resource_cell_styler();}"><strong>${_(u"updated")}</strong></th>
            <th data-options="field:'modifier',width:100,styler:function(){return datagrid_resource_cell_styler();}"><strong>${_(u"modifier")}</strong></th>
        </thead>
I use detailview
Logged

TravelCRM - opensource CRM for travel companies
jarry
Administrator
Hero Member
*****
Posts: 2298


View Profile Email
« Reply #1 on: July 05, 2015, 02:58:44 PM »

Please show an example to demonstrate your issue.
Logged
mazvv
Newbie
*
Posts: 20


View Profile WWW
« Reply #2 on: July 07, 2015, 12:49:56 PM »

My full code
Code:
    <table class="easyui-datagrid"
        id="${_id}"
        data-options="
            url:'${request.resource_url(_context, 'list')}',border:false,
            pagination:true,fit:true,pageSize:50,singleSelect:true,
            sortName:'deadline',sortOrder:'asc',
            pageList:[50,100,500],idField:'_id',checkOnSelect:false,
            selectOnCheck:false,toolbar:'#${_tb_id}',
            view: detailview,
            onExpandRow: function(index, row){
                var row_id = 'row-${_id}-' + row.id;
                $('#' + row_id).load(
                    '/tasks/details?id=' + row.id,
                    function(){
                        $('#${_id}').datagrid('fixDetailRowHeight', index);
                        $('#${_id}').datagrid('fixRowHeight', index);
                        $.parser.parse('#' + row_id);
                    }
                );
            },
            detailFormatter: function(index, row){
                var row_id = 'row-${_id}-' + row.id;
                return '<div id=' + row_id + '></div>';
            },          
            onBeforeLoad: function(param){
                param.performer_id = ${h.common.get_auth_employee(request).id};
                $.each($('#${_tb_id} .searchbar').find('input'), function(i, el){
                    if(!is_undefined($(el).attr('name')))
                        param[$(el).attr('name')] = $(el).val();
                });
            }
        " width="100%">
        <thead>
            % if _context.has_permision('delete'):
            <th data-options="field:'_id',checkbox:true">${_(u"id")}</th>
            % endif
            <th data-options="field:'title',sortable:true,width:180">${_(u"title")}</th>
            <th data-options="field:'status',sortable:false,width:60,formatter:function(value, row){return status_formatter(value);}">${_(u"status")}</th>
            <th data-options="field:'deadline',sortable:true,width:110,styler:function(){return datagrid_resource_cell_styler();}">${_(u'deadline')}</th>
        </thead>
    </table>
status_formatter function
Code:
function status_formatter(status){
if(status){
var span = $('<span/>').html(status.title);
span.addClass('status-label ' + status.key);
return $('<div/>').append(span).html();
}
}
functions status_formatter and datagrid_resource_cell_styler does not calls
« Last Edit: July 07, 2015, 12:53:49 PM by mazvv » Logged

TravelCRM - opensource CRM for travel companies
jarry
Administrator
Hero Member
*****
Posts: 2298


View Profile Email
« Reply #3 on: July 07, 2015, 05:35:14 PM »

Please refer to this example http://jsfiddle.net/8foyt6q9/. It works fine.
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!