We help IT Professionals succeed at work.
Get Started

How do I access a column, or cell's data of my jQuery datatable?

222 Views
Last Modified: 2016-03-25
I've got a jQuery datatable populated and have added a link in one of the columns to take the user to a different page for data processing. I need to pass the value of a particular column (cell) in the row. How do I do this? (see attatched code below)

        $(document).ready(function () {
            $.ajax({
                "url": "SignInGrid.aspx/getData",
                "type": "POST",
                "contentType": "application/json; charset=utf-8",
                "dataType": "json",
                "success": function (json) {
                    $('#example').DataTable({
                        "columns": [
                            {
                                "targets": 0,
                                "data": "DEALERID",
                                //"render": function (data, type, full, meta, oData) {
                                //    return '<a href="Contact.aspx?dealerid=' + data + '">' + data + '</a>';
                                "url": "Default.aspx/doLinkStuff"
                                //}
                            },
                            { "data": "EMAIL" },
                            { "data": "FIRSTNAME" },
                            { "data": "LASTNAME" },
                            { "data": "COMPANY" },
                            { "data": "CITY" },
                            { "data": "STATE" },
                            { "data": "ZIP" },
                            { "data": "BRANCH" },
                            {
                                "data": null,
                                "className": "center",
                                "render": function (data, type, full, meta, oData) {
                                    return '<a href="EditTimeRecord.aspx?timerecordid=' + data[0] +
                                    '&edit=y" class="editor_edit">Edit</a> / <a href="EditTimeRecord.aspx?timerecordid=' + data[0] +
                                    '&delete=y" class="editor_remove">Delete</a>'
                                }
                            }
                        ],
                        "aaData": $.parseJSON(json.d)
                    });
                }
            });
        });

Open in new window

Comment
Watch Question
Web Applications Developer
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE