Skip to content
This repository was archived by the owner on Feb 2, 2025. It is now read-only.

renderWith could handle returned DOM elements also #299

Closed
ilovett opened this issue Apr 24, 2015 · 4 comments
Closed

renderWith could handle returned DOM elements also #299

ilovett opened this issue Apr 24, 2015 · 4 comments

Comments

@ilovett
Copy link

ilovett commented Apr 24, 2015

I'd like to provide a compiled DOM element

colDef.renderWith(function(cell, type, row) {

  var renderScope = scope.$new(true, scope.$parent);

  renderScope.cell = cell;
  renderScope.row = row;
  renderScope.getScope = scope.$parent;

  // returns angular compiled html with expression
  return $compile('<button ng-click="getScope.myThing(row)">{{ row }}</button>')(renderScope);

});

However the output in my table cell is [object Object] (the DOM object). The renderWith listener could check to see if the returned value is a string or a DOM element, and if it's a DOM element to just append that.

May run in to issues with trusting html, in which case $sce.trustAsHtml() and ng-bind-html would need to be implemented into the solution.

@ilovett ilovett changed the title renderWith could handle returned DOM elements instead of html string renderWith could handle returned DOM elements also Apr 24, 2015
@l-lin
Copy link
Owner

l-lin commented Apr 28, 2015

Except that all renderWith is doing is setting the value of columns.render. The render function is expecting a string and angular-datatables cannot really change the DataTables behavior.

I don't really know if it's really possible to use the DOM element instead of a string.

@ilovett
Copy link
Author

ilovett commented May 1, 2015

Yes, you're right. There are a few issues open such as https://github.com/DataTables/DataTables/issues/435

It looks like the author is interested in the idea but is going to eventually implement his own solution.

@rubenspgcavalcante
Copy link

Having the same problem! Up! 👍

@l-lin
Copy link
Owner

l-lin commented Nov 25, 2017

Closing as issue is too old and the version is no longer maintained.

@l-lin l-lin closed this as completed Nov 25, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants