(Note that you do not need to know about datatables for this.)
I am creating a directive to handle DataTables . What I would like to do is an action column with two icons - edit and delete. These icons should respond to ng-click.
Datatables allow you to do this by providing a callback for a given column definition ( mRender ). This callback returns an html string for this cell value, which is inserted into the DOM instead of the actual cell value.
Checkout plunker . Two important functions stand out:
renderActionIcon is my implementation of the callback mentioned above. It generates the HTML string that I need in the cell.registerNewHtmlWithAngular is a function where I supposedly let angular know about the ng clicks that I need to register for this column.
What should be done in registerNewHtmlWithAngular ?
If $ compile html, angular adds the appropriate event listeners and returns an element to me, but since the Datatables function expects HTML, these registered elements will not be added to the DOM.
Any ideas? Thanks guys!
angularjs datatables
Roy Truelove Feb 06 '13 at 20:07 2013-02-06 20:07
source share