maxazan / jquery-treegrid

TreeGrid plugin for jQuery
http://maxazan.github.io/jquery-treegrid
MIT License
553 stars 222 forks source link

Ability to click not only the glyph but the whole word to expand the tree #30

Open e-designer opened 9 years ago

e-designer commented 9 years ago

It's hard to target the glyph in small devices (small screen). Is there any way to be clickable all the word to expand the subtrees?.

Tnx Chris

crabepet commented 9 years ago

Hi,

I've had the same issue and I did like this :

$(".tree tr").on("click", function(event){ $(this).treegrid('toggle'); });

When the user click on the table row, the tree expand / collapse !

sg157 commented 8 years ago

it like that $(".tree>tbody>tr>td:first-child").on("click", function(event){ var tr = $(this).parent(); $(tr).treegrid('toggle'); });

perlfan2009 commented 8 years ago

Hi - I'm not very familiar with JS - how do I implement this? Where do I have to place the code? Thanks for help. Frank

ChargingBulle commented 8 years ago

@perlfan2009 you put it where you init your treegrid. Here an example:

            <script type="text/javascript">
                $(document).ready(function() {
                    $('.tree').treegrid();
                    $(".tree tr").on("click", function(event){
                        $(this).treegrid('toggle');
                    });
                });
            </script>