How Populate data in datatable based on user input field.

How Populate data in datatable based on user input field.

giridhargiridhar Posts: 20Questions: 4Answers: 0
edited January 2014 in General
Hi friends,

Good day to you.

My name is giridhar,i have a doubt regarding data tables.

Iam getting data from controller to populate data in my datatables.

I need to get the data based on one input field(in my case customerid).

how should i achieve this.I tried but failed.

My jsp should contain an input field.Based on the input of the user i should display the data into datatable.

The input field and datatable should be independent to each other.


please help me.this is my code


$(document).ready(function() {
$("#user").dataTable({
"bProcessing" : true,
"bServerSide" : true,
"sAjaxSource" : "./CustomerService",
"sPaginationType" : "full_numbers",
"bPaginate" : true,
"bJQueryUI" : true,
"aaSorting": [[0,'desc']]
})
});






customerId:











CustomerName
Address
MobileNumber

Replies

  • ashiersashiers Posts: 101Questions: 8Answers: 7
    edited January 2014
    One way to go about this is to prompt the user on a separate JSP page using your form, send the ID to another JSP page which collects the ID as a parameter and passes it onto the JQuery code for DataTables using the "sAjaxSource" : "./CustomerService?id=1234", or you can check out this example: http://datatables.net/examples/server_side/custom_vars.html, or you can put the ID of the user into a Session object when they login after authentication has completed. That way when the CustomerService servlet receives a request, it can call up the Session and call the getAttribute(...) method. Since you're on the Java platform, it would be advisable for you to visit the JED website and consult the many examples there that explain how JED and DataTables work together on the Java platform. Check it out: http://jed-datatables.ca/jed/ The trial version is free.
  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    Doesn't a HTML form require an "action" attribute?
  • giridhargiridhar Posts: 20Questions: 4Answers: 0
    Hi thanks for your reply.i can put the customer id input field in a separate jsp and redirect it to another jsp for displaying.the problem here is if want to search with a different input,every time i should go to first jsp,because the results are displayed in second jsp.how to avoid this.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    edited January 2014
    Please post questions only once. The forum rules are very clear.

    1. Do: Provide a link to the web-page your question is about.
    2. Do not: Post the same question multiple times.

    You followed neither rule. I have closed you other discussions and left this one open so you can provide a test case.

    Allan
This discussion has been closed.