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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:59:24+00:00 2026-05-31T17:59:24+00:00

I have a simple form with a single button and a datatable with a

  • 0

I have a simple form with a single button and a datatable with a bunch of data. When the user selects one of the options I want the datatable to refresh the data by passing an kwarg – that being value of the selection, which will reduce the data size..

My Question:

How do I use fnServerParams to make this cleaner??

My basic select.

<div class="span-15 last"><select name="customer" id="id_customer">
    <option value="" selected="selected">---------</option>
    <option value="1">A</option>
    <option value="2">B</option>
    <option value="4">C</option>
</select></div>

And the corresponding js.

<link rel="stylesheet" href="{{STATIC_URL}}css/datatable.css" />
<script type="text/javascript" src="{{STATIC_URL}}js/jquery.dataTables.min.js"></script>
<script style="text/javascript">
    $(document).ready(function() {

        $('#data_table').dataTable({
            'sPaginationType':'full_numbers',
            'sDom': '<lf><"clear">rt<"bottom"<"tpad"i<"clear"p>>>',
            "bProcessing": true,
            "sAjaxSource": "{% url incentive_distribution_homes_ajax_list %}"
        });

        $('#id_customer').change(function () {
            var builder_id =  $(this).val();

            //fix this using fnServerParam??

            $('#data_table').dataTable({
                "bDestroy":true,
                'sPaginationType':'full_numbers',
                'sDom': '<lf><"clear">rt<"bottom"<"tpad"i<"clear"p>>>',
                "bProcessing": true,
                "sAjaxSource": "{% url incentive_distribution_homes_ajax_list %}",
                "fnServerData": function ( sSource, aoData, fnCallback ) {
                    $.ajax( {
                            "dataType": 'json',
                            "type":"GET",
                            "url": sSource,
                            "data" : { 'builder_id': builder_id } ,
                            "success": fnCallback
                    })
                }
            });
        });
  • 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-31T17:59:25+00:00Added an answer on May 31, 2026 at 5:59 pm

    This is what I would do:

    I would create another javascript object to act as a listener on #id_customer, configure it such that if the DOM changes, it will call datatables (or the appropriate function therein.)

    From there, to get the data you want passed along to the server, use “fnServerParams”, and extract the value you want to pass along from the DOM.

    Docs are here on that variable, as well as examples:

    http://datatables.net/release-datatables/examples/server_side/custom_vars.html

    Once you pass that along, you will need to catch it on the server side (but not in the URLs, you shouldn’t have to add additional parameters there.) Just look for “fnServerParams” in the request.GET.

    (and for what its worth, you can use django_datables to solve this)

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

Sidebar

Related Questions

I have a very simple form with a single autocomplete widget. No submit button.
I have a simple form on a view page, implemented as a user control,
I have a simple form on a page and I want to auto submit
I have a very simple voting form. It contains a single text field for
I have a simple Form with a single TextBox, plus OK and Cancel buttons.
In my asp.net webform page I have a simple form with a single inputfield
I have a simple input form that consists of a single textbox and an
I have some simple C# application (single form) originally written in VS on win.
In Play 2.0 Scala application I have simple page with Form with one parameter.
I have simple form. <form target=_blank action=somescript.php method=Post id=simpleForm> <input type=hidden name=url value=http://...> <input

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.