How to expand and collapse all accoutns using Jquery..

Posted by kumar on Stack Overflow See other posts from Stack Overflow or by kumar
Published on 2010-04-29T14:21:12Z Indexed on 2010/04/29 14:27 UTC
Read the original article Hit count: 341

Filed under:

Here is my code to expand and collapse all the users on the grid..

But problem is without clicking expand buttong if I open any user..its opening fyn,, but if I click again on the expand button happening the opened subgrid is closing and closing one is opening...

here is my code can anybody tell me what's the wrong with this.

<script type="text/javascript">
 $(document).ready(function() {
    $('#tmpOpen').click(function() {
        var value = document.getElementById("tmpOpen").value;
        if (value == "Expand All Accounts") {
            document.getElementById("tmpOpen").value = "Collapse";
            loadAll();
        }
        else {
            document.getElementById("tmpOpen").value = "Expand";
            loadAll();
        }
    });
   function loadAll() {
            var o = true;
            $('#Grid1 tr[role="row"] td a').each(function(row) {
                if (o) {
                    $(this).trigger('click');
                }
            });
        }
    });

</script>

© Stack Overflow or respective owner

Related posts about jQuery