Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 925117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:28:15+00:00 2026-05-15T19:28:15+00:00

I am trying to implement a function on jquery datatable, that returns the 1st

  • 0

I am trying to implement a function on jquery datatable, that returns the 1st and the 4th column of a clicked row

i am following this example, which allows me to manipulate a clicked row
http://datatables.net/examples/api/select_single_row.html

thinking that i can change this handler to do the read cell value procedures and use the value on my own logic

/* Add a click handler to the rows - this could be used as a callback */
$("#example tbody").click(function(event) {
    $(oTable.fnSettings().aoData).each(function (){
        $(this.nTr).removeClass('row_selected');
    });
    $(event.target.parentNode).addClass('row_selected');
});

i have also come over with this little code segment from dataTable forum http://datatables.net/forums/comments.php?DiscussionID=1384&page=1#Item_0

$('#example tbody tr').click( function () {
    // Alert the contents of an element in a SPAN in the first TD
    alert( $('td:eq(0) span', this).html() );
} );

may i have any pointer so i can get the 1st and 4th column of the clicked field?

next part
I have the above solved, thanks nick

however i have the next part of the problem. when i init the table
i use

/* Init the table */
    oTable = $('#filetable').dataTable( {
        "bProcessing": true,
        "bServerSide": true,
        "sAjaxSource": "/crvWeb/jsonFileList.do",
        "fnServerData": function ( sSource, aoData, fnCallback ) {
            $.ajax( {
                "dataType": 'json', 
                "type": "POST", 
                "url": sSource, 
                "data": aoData, 
                "success": fnCallback
            } );
        }
    } );

my servlet takes a dir request parameter and returns a listing to the datatable as json response.

/crvWeb/jsonFileList.do

how can i add and get serlvet response with post request so i can have my table updated?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T19:28:16+00:00Added an answer on May 15, 2026 at 7:28 pm

    You can use .delegate() easiest here, like this:

    $("#example tbody").delegate("tr", "click", function() {
      var firstCellText = $("td:first", this).text();
      var fourthCellText = $("td:eq(3)", this).text();
    });
    

    You can try out a demo here

    With .delegate() this refers to the <tr> since that’s the click we’re handling, making things quite a bit cleaner..and it’s still only one event handler at the <tbody> level, not one per <tr>.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to implement this jQuery auto complete function but the problem is
I am trying to implement a simple C++ function that adds a node to
I'm trying to implement unit tests for function that uses imported external objects. For
I've been trying to implement the jquery validator that is the suggested answer here:
I have this jQuery script I'm trying to implement om Magento and I've tried
I'm trying to implement the Toggle function in Jquery for the first. When I
I've been trying to implement jQuery's grid function in my Asp.Net MVC app. I'm
i am trying to implement jquery datatable , in my cakePHP based website, but
I'm trying to implement a jQuery function with an infinite loop to animate the
I am just trying to implement the most basic example of setInterval with jQuery

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.