Expand and Collapse on buttong click

Posted by kumar on Stack Overflow See other posts from Stack Overflow or by kumar
Published on 2010-04-29T19:54:13Z Indexed on 2010/04/29 19:57 UTC
Read the original article Hit count: 341

Filed under:

Please this is not a duplicate thread do consider this one..thanks..

 function loadAllAccounts() {
            $('#Grid tr[role="row"] td a').each(function(row) {
            if ($('#CGrid tr[role="row"] td.hasClass(sgcollapsed) a')) {
               $(this).click();
               }
               else if ($('#Grid tr[role="row"] td.hasClass(sgexpanded) a')) {
                    return false;
                }
            });
        }

First time the grid is loading with all the user data..at very firsst row each use can exapdn the grid to see subgird using + sign,, when use clicks + sign I am expanding the row to show subgrid,

above code is working at very frist time when I click expand button its expanding all the rows and collpase its colaapsing allt he rows perfectly,

but user open any row to see subgrid,, after clicking the expand button opened row will closing and closing rows will be opening.. exactly its doing opposite?

can anyone sujjest me what is this cause in the code? thanks

© Stack Overflow or respective owner

Related posts about jQuery