EasyUI Forum
May 09, 2024, 12:13:52 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: TreeGrid : Can't scroll columns when there no rows  (Read 9776 times)
itay-g
Newbie
*
Posts: 35


View Profile
« on: August 20, 2014, 01:45:56 AM »

Hello!

A scroll doesn't appear in the TreeGrid unless there is a row,
for example :
When there are no rows in the TreeGrid,
and the columns extend over the panel's size, you can't see some of the columns and a scroll doesn't appear until there are rows in the grid, meaning you can't look at all the columns.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: August 21, 2014, 12:53:38 AM »

Please try to override the treegrid view to solve this issue.
Code:
<script>
(function($){
render = $.fn.treegrid.defaults.view.render;
$.extend($.fn.treegrid.defaults.view, {
render: function(target, container, frozen){
$(container).children('table.datagrid-btable-stub').remove();
render.call(this, target, container, frozen);

var state = $.data(target, 'treegrid');
var dc = state.dc;
if (dc.body2.is(':empty')){
var fields = $(target).treegrid('getColumnFields', frozen);
var table = ['<table class="datagrid-btable-stub" cellspacing="0" cellpadding="0" border="0"><tbody>'];
table = table.concat(this.renderRow.call(this, target, fields, frozen, 0, {}));
table.push('</tbody></table>');
$(container).html(table.join(''));
$(container).find('div').height(0);
}
}
})
})(jQuery);
</script>
Logged
hande89
Jr. Member
**
Posts: 56


View Profile
« Reply #2 on: August 21, 2014, 01:42:32 AM »

I have the same problem. Solution seems to be working on page load but not if client side filtering returns 0 rows.
Logged
itay-g
Newbie
*
Posts: 35


View Profile
« Reply #3 on: September 07, 2014, 03:57:53 AM »

Hey jarry,
the solution worked, but it created various other problems since the grid now has a "fake" row - which for examples causes RenderRow to call the styler of that row, which causes an exception in our code since the row being sent is simply empty. The same happened in various other places.

Is there another possible fix for this problem?
Thank you.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #4 on: September 07, 2014, 08:18:48 AM »

No matter what styles are applied to this hidden row, it does not affect the user to operate the treegrid since the row is hidden. You must make sure that your 'styler' code can run well on any working environments even encountering an empty row.
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!