Row template example not working?
http://ui-grid.info/docs/#/tutorial/4.1_custom_row_template
I can't seem to get this code to work in my project, and it looks like it's broken on the site too.
Is it wrapped in a $timeout function because of the $http.get? Why not use a promise instead?
Also, the table doesn't seem to render when you apply a custom row template.
@c0bra sorry, I didn't know which place to post this. I hope this is actually a legitimate issue and not me being stupid!
@axschech No worries; it is definitely a legitimate issue. Looks like the custom row template is being returned to uiGridRow, but it's being compiled weird. Looking at the DOM it has an ngRepeat comment for the columns but it's not being expanded. Not sure when this would have broken; it did work at one point.
$timeout() does return a promise. It's intended to just be a quick way of showing asynchronous row template usage.
@c0bra I'm sorry I meant "why not use $resource" instead. This way you don't waste any time between since instead of waiting an arbitrary amount of seconds you would be waiting until the data was received and loaded.
edit: also thanks for the fix!
@c0bra is there anyway to add an ng-click directive to the row using this method?
Should be able to. Grid cells or row selection (once done) may capture click events though. What would you want to do with clicking?
well eventually it will open a context menu (perhaps a roadmap feature?) but right now I'm just trying to get it to work.
I have a function in my controller:
$scope.theClick = function() {
console.logged("clicked");
}
and here is my template string: rowTemplate:
'<div style="background-color: aquamarine" ng-repeat="col in colContainer.renderedColumns track by col.colDef.name" ng-click="theClick()" class="ui-grid-cell" ui-grid-cell></div>'
Perhaps it's a scope issue? Is the cell / row outside of the scope of my controller?
all grid scope is now isolate. You must use externalScopes attribute. See api docs http://ui-grid.info
Would you mind giving me an example? The documentation isn't very clear.
Would it be something like externalScopes="theClick()" on the ui-grid div?
ever solved this issue?
Have the examples been updated? I can't get the row templates to show anything at all. Using the "default"
<div ng-style="{\'cursor\': row.cursor, \'z-index\': col.zIndex() }" ng-repeat="col in renderedColumns" ng-class="col.colIndex()" class="ngCell {{col.cellClass}}" ng-cell></div>
@FlavorScape @mikila85 are you still having an issue where where you are unable to set a custom rowTemplate?
I was able to, but had to reference the src for the templates. It's just that the example code no longer works, so I guess it's not a huge deal. But, the examples seem to exist in a few places, so it's easy to miss this tidbit.
I am trying to use the default example given at https://github.com/angular-ui/ui-grid/wiki/templating for the row template. When I put that template as grid row template, I get nothing displayed. I can see the commented ng-repeat inside row for 'col in renderedColumns' as @c0bra commented above long back. I am using angular "1.5.6" and ui-grid "3.2.9". Has this been fixed?