- Notifications
You must be signed in to change notification settings - Fork 2.4k
fix(core): fix external template loading for grid-filter, grid-footer… #5851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…-cell and grid-header-cell Fixes external template loading for `grid-filter`, `grid-footer-cell` and `grid-header-cell`. This issue occurs when trying to use `filterHeaderTemplate`, `footerCellTemplate` or `headerCellTemplate` on a column definition with an external template (e.g. `myPersonalTemplate.html` as a value). In fact, Angular UI grid was not waiting for the template to be loaded before executing `$elmt.append()` function and the template was not displayed (empty template). This fix waits for the external template to be loaded first.
| is there an issue # that this is resolving, or a plunkr? |
| Can you please also add unit tests? |
| Hi ! I just looked at your issue backlog. It fixes issues about headerCellTemplate loading: And it also fixes the same issues for filterHeaderTemplate loading (nothing in your backlog) |
| I'll try to add some unit tests to the code I committed. |
| @pleandre Any progress? |
| Closing due to lack of response. Feel free to reopen this when you have time to add some tests. |
| Is this fix going to be in the future release? |
| Hey guys, this piece of code is still really important! |
| @mportuga col.cellTemplatePromise = templateGetPromises[0]; // Code from master For the cell template it was getting a promise but for others it was not: headerCellTemplate, footerCellTemplate, filterHeaderTemplate. Thus it was not waiting for the template to be loaded and appending an empty template for the header, footer and filter if it was not loaded. I just looked at the same way it was done for cellTemplate and applied it to headerCellTemplate, footerCellTemplate and filterHeaderTemplate It was not tested and their was no reason it was done in a different way for cellTemplate. I gave up adding test, I looked a bit but it seems complicated to test. For headerCellTemplate, footerCellTemplate, filterHeaderTemplate there is no mechanism that waits for the template to be loaded. I don't see how to test that if I load an external template which is too slow to load, then it will wait for it to be loaded. I tried but it is not an easy thing to test and I cannot spend days on this. Could you merge it without test ? There is no reason to have a different way of loading for cellTemplate and the other templates. There was no test commited to test or to explain this difference with cellTemplate. |
| @dlgski @mportuga could I get an answer on this or get a hint to unit test it, but there is no reason to do it in one way for celltemplates and another way for others. I just applied the same logic as celltemplates. Could you re-open this pull request ? we have to maintain our own version of the library because of this bug on a forked branch. |
| I also really need this, thanks! |
| i am having the same issue. could really use this fixed. when will it be merged? |
| Hi, this pull request is still important and fixes template loading issues. There was two different way of loading templates: one was using a promise and waiting for completion before appending the template, the other was not using promise / waiting for completion. In this pull request I changed to use the same way everywhere and it fixed my problem. Could you give some advice for the unit test you expect, it seems a bit complicated to implement and there is no existing tests for the current way. Otherwise would it be possible to merge it ? |
…-cell and grid-header-cell
Fixes external template loading for
grid-filter,grid-footer-cellandgrid-header-cell.This issue occurs when trying to use
filterHeaderTemplate,footerCellTemplateorheaderCellTemplateon a column definition with an external template (e.g.myPersonalTemplate.htmlas a value).In fact, Angular UI grid was not waiting for the template to be loaded before executing
$elmt.append()function and the template was not displayed (empty template).This fix waits for the external template to be loaded first.