using a url in cellTemplate in columnDef causes grid to malfunctions.
If I include the html inline, it works fine, but as soon as its a remote file, the entire grid malfunctions having the headers be only a few pixels in height and the contents of the grid be invisible.
Which version are you using?
Reported on rc14, but similar issues happens on rc15.
On rc15, the grid contents show, but the header is still only a few pixels in height.
Here's a plunker demonstrating the problem: http://plnkr.co/edit/vXitx2XI5aLvG2YCRY4c?p=preview I think it may have something to do with leading/trailing whitespace in the cellTemplate when trying to $compile it. Investigating...
OK, the leading and trailing whitespace is not a problem. It's purely the remote $http call that is causing the cell to be blank...
Got it, I think. The problem is right here: https://github.com/angular-ui/ng-grid/blob/c19ffb101e86e02836dd3b9c760e9f769197e363/src/js/core/directives/ui-grid.js#L79
The dataWatchFunction gets called twice. First with an empty array, then with an array containing the data from the $http call. The problem is that the promises are getting resolved out of order. So the callback for the empty array is occuring AFTER the callback with the data. Your data gets set, then it gets cleared out.
Update: It appears to happen because when the initial empty data array comes in, it tries to build the columns off of it and creates a promise. But on the second go-around it skips that attempt and thus there's no promise, which probably resolves instantaneously with $q.all(). Meanwhile buildColumns() promise gets resolved and its callback, with the empty data set, blows away the rows.
Still happening. If I do a ctrl-F5, the header columns get set to only a few pixels in height, whereas if I just navigate to the page, they work fine.
Only happens when I include a column using cellTemplate.
@joshmackey If you're having issues with the inline template, I've fixed this in the past by wrapping the whole template in a <div>. For example:
<script type="text/ng-template" id="blah2.html">
<div class="ui-grid-cell-contents">TEST: {{COL_FIELD CUSTOM_FILTERS}}</div>
</script>
I also looked at your example and changed cellTemplate to blah.html and things seem to work fine.
This was due to a different issue. #2110 caused it.
When I removed the offending styles, it all worked.
I am also facing this issue. I wanted auto-focus on the input element on click of filter button(external filter). So I explicitly defined the headerCellTemplate in columnDefs. I am keeping the html code in a separate template and I am trying to reference the in columnDefs. In the console it says fetching URL and does not actually apply the template in the header.