EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: mazvv on June 24, 2014, 11:57:17 AM



Title: DataGrid Detailview + ajax
Post by: mazvv on June 24, 2014, 11:57:17 AM
Hi.
I try to use ajax for detailview. Part of my code is
Code:
            
            onExpandRow: function(index, row){
                var row_id = 'row-' + row.id;
                $('#' + row_id).load('/banks_details/details?id=' + row.id);
            },
            detailFormatter: function(index, row){
                var row_id = 'row-' + row.id;
                return '<div id=' + row_id + '></div>';
            },         
it works, but is this right way?


Title: Re: DataGrid Detailview + ajax
Post by: jarry on June 25, 2014, 05:38:20 PM
The 'detailFormatter' function only provide the detail content container. You can append any contents to this container.


Title: Re: DataGrid Detailview + ajax
Post by: mazvv on June 26, 2014, 02:23:36 AM
The main problem is height fixing of detailview row container.
Seems I had found good solution to do detailview with ajax, may be this code will be helpful
Code:
            view: detailview,
            onExpandRow: function(index, row){
                var row_id = 'row-${_id}-' + row.id;
                $('#' + row_id).load(
                    '/bpersons/details?id=' + row.id,
                    function(){
                        $('#${_id}').datagrid('fixDetailRowHeight', index);
                        $('#${_id}').datagrid('fixRowHeight', index);
                    }
                );
            },
            detailFormatter: function(index, row){
                var row_id = 'row-${_id}-' + row.id;
                return '<div id=' + row_id + '></div>';
            },