ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

Expandable rows

Open jssebastian opened this issue 13 years ago • 3 comments

Digging through the docs, I could not figure out if this is already possible with the existing templating support.

I would like to be able to click on a row to expand it, showing details about the row not in a separate details tab but right there inline in the table. That is, with the row expanding sort of like an accordion with arbitrary (transcluded?) content shown.

jssebastian avatar Jan 29 '13 22:01 jssebastian

Flexible height plugin: https://github.com/angular-ui/ng-grid/tree/master/plugins

orneryd avatar Feb 01 '13 18:02 orneryd

Currently nggrid doesn't support this feature [issue #1111][1] and its being implemented in UIGrid 3.0 version.

But i have found a workaround and this is how you can try to achieve in nggrid using rowTemplate and a little bit of jquery. hope this helps!

rowTemplate:

"< div class="row" >"

"add column data"

// expand or collapse image

< div class=\"col-xs-1 col-md-1\" >< img "id='**showHide**_{{row.rowIndex}}' ng-src='src/img/{{**imgArrowRight**}}' ng-click=\"**rowExpand** (row.rowIndex);\" />< / div>"< /div>< div id='**expRowId**_{{row.rowIndex}}' style=\"display:none;\">< div class=\"**expData**\">< span ng-bind=\"**row.entity.Attr**\">< /span>

//add whatever you want in the expanded row.< /div>< /div>

//Defined customArray for handling dynamic row Toggle

angular.forEach($scope.gridData, function(row,index) { $scope.customArray[index] = true; });

//row expand code

$scope.rowExpand = function(index){ $scope.customArray[index] = $scope.customArray[index] === false ? true : false;

                    if($scope.customArray[index]){
                        $('#showHide_'+index).attr('src','src/assets/img/rigthIcon.gif');
                        $('#expRowId_'+index).hide();
                    }else{
                        $('#showHide_'+index).attr('src','src/assets/img/downIcon.gif');
                        $('#expRowId_'+index).show();
                    }
                }

johny25 avatar Apr 29 '15 17:04 johny25

Forgot to meniton in my above comment please override ngRow class too. hope this helps!

.ngRow { position: relative !important; }

johny25 avatar Apr 29 '15 17:04 johny25