This is a migrated thread and some comments may be shown as answers.

Expand/Collapse nested view on client side

0 Answers 190 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Yotam
Top achievements
Rank 1
Yotam asked on 07 May 2012, 10:23 AM
hi
I was looking for a way to expand a nested view (and collapse all the others) on client side
and since I couldn't find one, I've decided to post my own resolution
I'm using a little bit of jQuery so I could catch the expand button mouseover event

<script type="text/javascript">
    $(document).ready(function () {
        //expand details row to show more data on a certain work
        $(".rgExpandCol").live("mouseover", function (event) {
 
            var masterTable = $find("<%= Grid1.ClientID %>").get_masterTableView();
          //collapse all
            for (var i = 0; i < masterTable.get_dataItems().length; i++) {
                masterTable.collapseItem(i);
            }
            //expend row
            for (var i = 0; i < masterTable.get_dataItems().length; i++) {
 
                if (masterTable.get_dataItems()[i].get_element() == $(this).parent()[0]) {
                    masterTable.expandItem(i);
                    break;
                }
 
            }
             
        });
 
    });
</script>

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Yotam
Top achievements
Rank 1
Share this question
or