Datatables : How to render <a> html tag?

Dark Cyber

Here is my datatables init.

var dataTable = $('#categoriesTable').dataTable(
    {
    "pageLength": 5,
    "lengthMenu": [[5, 10, 25, 50, 100], [5, 10, 25, 50, 100]],


    "ajax": {
        url: "http://mata.mu/coeg_cms/sempak/posts/categories",
        type: "GET"
    },
    "bSort": false,
    "columns" : [
        { "data": "name"},
        { "data": "slug"},
        { "data": "term_taxonomy.description"},
        { "data": "term_id", "render": function(data, type, full, meta){
                var delete_url = '<a href="'+$(location).attr('href')+'/'+data+'" class="button small alert expand" data-method="delete" data-reveal-id="myModal'+data+'" data-name="'+name+'">Delete</a>';
                return delete_url;
            }
        }
    ],


    "responsive" : true
});

yes the above code will generate table then add column for action delete

<a href="http://mata.mu/coeg_cms/sempak/posts/categories/71" class="button small alert expand" data-method="delete" data-reveal-id="myModal71" data-name="">Delete</a>

why data-name attribute is blank ? it should show name from first column ? how to do that ? please correct my render function

flyingL123

The name variable is not defined. You need to get the value of it using the full argument that you are passing to your function.

The full variable represents the data for the entire row. So you can use that to access the name for that row.

You can probably just do full.name to get the name.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Datatables : How to render <a> html tag?

From Dev

How to render PDF byte array in an HTML Object tag

From Dev

How to render a HTML tag from json value using angularJs

From Dev

XSL How to render html within element with no CDATA tag

From Dev

How to render the_field(); string with a <iframe> tag' as HTML?

From Dev

How to render text inside jsx "tag" like a normal HTML?

From Dev

React | render html tag in jsx

From Dev

How do I use orthogonal data in DataTables to sort when using HTML in a render function?

From Dev

How can I render a shiny datatables as a link

From Dev

How to render same list in multiple datatables in primefaces

From Dev

How to dynamically not render a script tag?

From Dev

How to display additional tag in jquery datatables with ajax?

From Dev

How to wrap a td with anchor tag on datatables plugin

From Dev

Datatables - Store hidden data in each row and use it to render HTML

From Dev

Django, datatables doesn't render table in html template

From Dev

Datatables - Store hidden data in each row and use it to render HTML

From Dev

How to render html dynamically?

From Dev

How to render Html with smarty

From Dev

How to render html as text

From Dev

add link or any html tag to column in django-datatables-view

From Dev

How to not render the content in the <content> tag in Shadow DOM?

From Dev

How to render <base> tag in wicket framework

From Dev

jquery datatables how to render and sort mm-dd-yyyy

From Dev

Jquery Datatables How to get column Id in render function

From Dev

How To Display Bootstrap Toggle Switch with DataTables via Render

From Dev

How to print "<" in HTML tag?

From Dev

How to replace a Html Tag?

From Dev

How to print "<" in HTML tag?

From Dev

how to match html tag

Related Related

  1. 1

    Datatables : How to render <a> html tag?

  2. 2

    How to render PDF byte array in an HTML Object tag

  3. 3

    How to render a HTML tag from json value using angularJs

  4. 4

    XSL How to render html within element with no CDATA tag

  5. 5

    How to render the_field(); string with a <iframe> tag' as HTML?

  6. 6

    How to render text inside jsx "tag" like a normal HTML?

  7. 7

    React | render html tag in jsx

  8. 8

    How do I use orthogonal data in DataTables to sort when using HTML in a render function?

  9. 9

    How can I render a shiny datatables as a link

  10. 10

    How to render same list in multiple datatables in primefaces

  11. 11

    How to dynamically not render a script tag?

  12. 12

    How to display additional tag in jquery datatables with ajax?

  13. 13

    How to wrap a td with anchor tag on datatables plugin

  14. 14

    Datatables - Store hidden data in each row and use it to render HTML

  15. 15

    Django, datatables doesn't render table in html template

  16. 16

    Datatables - Store hidden data in each row and use it to render HTML

  17. 17

    How to render html dynamically?

  18. 18

    How to render Html with smarty

  19. 19

    How to render html as text

  20. 20

    add link or any html tag to column in django-datatables-view

  21. 21

    How to not render the content in the <content> tag in Shadow DOM?

  22. 22

    How to render <base> tag in wicket framework

  23. 23

    jquery datatables how to render and sort mm-dd-yyyy

  24. 24

    Jquery Datatables How to get column Id in render function

  25. 25

    How To Display Bootstrap Toggle Switch with DataTables via Render

  26. 26

    How to print "<" in HTML tag?

  27. 27

    How to replace a Html Tag?

  28. 28

    How to print "<" in HTML tag?

  29. 29

    how to match html tag

HotTag

Archive