Any way to insert anchor elements into the table dom?
Any way to insert anchor elements into the table dom?
BlueHues
Posts: 16Questions: 5Answers: 0
I'm not particularly well acquainted with doms and i'm wondering if I can somehow insert anchor elements and/or simple text into the table dom, just how, say, the buttons are inserted in a 'Bfrt' dom
This question has an accepted answers - jump to answer
Answers
If you mean "How to insert a link in a table td element", there's an example here:
https://datatables.net/reference/option/columns.render
Not quite. I'm simply (hopefully) trying to use the table DOM, so I could line up both the filter input that the datatables provide via dom and my own anchor elements into one line, so it would look more pleasing.
Try this:
https://datatables.net/examples/advanced_init/dom_toolbar
Yes, that's exactly it! Thank you!
After quite a bit of testing, i cant seem to be able to insert an actual, working anchor element, as it becomes simple unclickable text. Am I missing something?
Here's the code:
The dom
The "linkA" element:
The output (doesn't work as a link, obviously):
Adding an
href
attribute to your code provides a clickable link:https://live.datatables.net/xovatefi/1/edit
I'm not familiar with ASP.NET but the asp-action doc seems to indicate that the above CSHTML will be converted to something like this:
Not sure what the
asp-route-page
would convert to.Kevin
It depends how the
-asp-action
attribute works. Does ASP need something to run for that to be picked up? I don't know I'm afraid - you'd need to ask in an ASP forum or perhaps StackOverflow.Allan
Hi! thanks for the inputs so far. You can think of the asp-route-page as a variable that is passed to the ActionA method, so i dont think it'll cause me too much trouble.
I've changed The link as per Kevins suggestion, and it works just fine now. Once again, thanks for the extensive help.