Need advice on DataTables.

Need advice on DataTables.

jQuery_userjQuery_user Posts: 27Questions: 0Answers: 0
edited October 2010 in General
Hello All,

I am new to jQuery and more so, to DataTables.
Can anybody give me an example/sample code/Architecture advice on how to implement DataTables inside a web application. Currently this web application uses JSP, and JavaBeans to access MS SQL database using JDBC.


Thanks

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Assuming your tables have less than 2000 rows (more than that, and IE will start running a bit slow, so consider server-side processing), you just output the table into HTML as normal and run DataTables on top of it: http://datatables.net/examples/basic_init/zero_config.html

    Allan
  • jQuery_userjQuery_user Posts: 27Questions: 0Answers: 0
    [code]$(document).ready(function() {
    $('#example').dataTable();
    } );[/code]

    I am a novice jQuery user,
    can you elaborate on the code in the "zero_config.html" example?
    In my app, a JSP uses bean to get an "ArrayList" of objects, how should I output this ArrayList into HTML,
    Any suggestions on how to do this better?

    Thanks
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    I'm no JSP developer so I can't say, but how would you normally output an array as HTML? It might be better to ask that question on a JSP forum - I guess there much be a 'for' command, and an 'echo' or 'print' which would do it. Once you have the table as HTML, just run the code you have above.

    Allan
  • jQuery_userjQuery_user Posts: 27Questions: 0Answers: 0
    edited October 2010
    Allan,

    Thanks for your advice. It is working now.

    The images are not getting displayed (sort_desc.png, sort_asc.png) even though I copy-pasted them in my project "images" folder. What other configurations should I do, to include the style sheets and images?

    Thanks
This discussion has been closed.