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 5976547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:14:40+00:00 2026-05-22T21:14:40+00:00

I am having a datatable displayed using jquery datatable from a codeigniter controller. What

  • 0

I am having a datatable displayed using jquery datatable from a codeigniter controller. What i wanna know is how do i send values from within the datatable back to a controller and use those values to retrieve new records from DB and then load them on again into the page.

My current code is

$(function(){
    $('#tableChart').dataTable( {
        // -------Function for formatting the table data elements-------
        "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {


                $.each(aData, function (i, elem){                       
                    $('td:eq('+i+')', nRow).html( '<b><font color="#40A913">'+aData[i]+'</font></b>' );
                }) 
                return nRow;
        },



            "bAutoWidth": false,
            "bProcessing": true,
            "bLengthChange": false, // Remove the show list drop down button
            "bInfo": false,         // Remove info part under the table
            "bFilter" : false,      // Remove search box
            "bDestroy": true,           // Remove table & recreate table

            "bServerSide": false,

            "sAjaxSource": "<?php echo base_url(); ?>index.php/print_db_table/get_print_db_table/<?php echo $table_name; ?>",

    });         
});

<div class="container"> 
    <div class="holderForTableChart">   
        <table width ="100%" cellpadding="5" cellspacing="0" class="display" id="tableChart"> 
            <thead> 
                <tr id="tableHeadder" > 
                    <?php
                        foreach($table_header as $item):
                            $header = $item->name;
                            echo '<th>'.$header.'</th>' ;
                        endforeach;
                    ?>                                              
                </tr> 
                <tr>
                <td></td>
                <td>
                <select id=""></select>
                <select id=""></select>
                </td>
                <td>
                <select id=""></select>
                <select id=""></select>
                </td>
                <td>
                <select id=""></select>
                <select id=""></select>
                </td>
                <td>
                <select id=""></select>
                <select id=""></select>
                </td>
                </tr>
            </thead> 
            <tbody> 
                <tr> 
                    <td colspan="6" class="dataTables_empty">Loading data from server</td> 
                </tr> 
            </tbody> 
        </table>    
    </div>
</div>

Now when i select a min max value in any one of the select boxes it must be sent to the controller from where i can send them to a model and collect them and reload them in the view

  • 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-22T21:14:41+00:00Added an answer on May 22, 2026 at 9:14 pm

    humm… assuming this select box has id as #min_max_value
    your javascript code will be something like in code down below.
    This code will re-invoke ajax and will redraw table.
    On the codeigniter controller u will be able to grab this min max value as $_POST[‘min_max_value’]

    i referred to this page on fnServerData section for ur issue
    http://www.datatables.net/usage/callbacks

    var oTable = '';
    $(function(){
        oTable = $('#tableChart').dataTable( {
            // -------Function for formatting the table data elements-------
            'fnRowCallback': function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
                    $.each(aData, function (i, elem){                       
                        $('td:eq('+i+')', nRow).html( '<b><font color='#40A913'>'+aData[i]+'</font></b>' );
                    }) 
                    return nRow;
            },
                'bAutoWidth': false,
                'bProcessing': true,
                'bLengthChange': false, // Remove the show list drop down button
                'bInfo': false,         // Remove info part under the table
                'bFilter' : false,      // Remove search box
                'bDestroy': true,       // Remove table & recreate table
                'bServerSide': false,
                'sAjaxSource': '<?php echo base_url(); ?>index.php/print_db_table/get_print_db_table/<?php echo $table_name; ?>',
    
                'fnServerData': function (url, data, callback) {
                    // Add new data 
                    data.push({'name':'min_max_value', 'value':$('#min_max_value').val()});
                    $.ajax({
                        'url': url,
                        'data': data,
                        'type': 'POST',
                        'success': callback,
                        'dataType': 'json',
                        'cache': true
                    });
                },
        });         
    
        $('#min_max_value').change(function(){
            oTable.fnDraw();
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am displaying values from database table using h:datatable, one tupple is displaying in
I'm using the DataTables jQuery plugin and am having issues with the First and
I'm having a problem deleting rows from a datatable. In my program, I am
I am using jquery datatables to display data from a mysql database. When you
I have a jquery datatable using the following code: // Test list table $('#dashboard_testlist_table').dataTable({
I'm using the dataTables jQuery plugin (which is totally awesome), but I'm having trouble
I have small lightswitch application having CreateNewUser Screen. Screen fields comes from Datatable added
I'm having some trouble when I try to parse a value within an jquery
I'm having problems with a DataTable line, the idea is that I want to
Currently i am having some problems with getting some data out of a DataTable

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.