Simple Datatable implementation

Simple Datatable implementation

johnsamjohnsam Posts: 17Questions: 0Answers: 0
edited December 2011 in DataTables 1.8
Hi ,

I am new to datatable .Can anyone help to use it with JSP?

I am trying to call a txt file which contains JSON format:

{"sEcho":3,"iTotalRecords":10,"iTotalDisplayRecords":2,"aaData":[["1",0,0,"2",0]]}

My JSP page:


$(document).ready(function() {

$('#ProResults').dataTable( {
"bProcessing": true,
"bServerSide": true,
"aaSorting":[],
"sAjaxSource": "testJSON.txt"

} );

} );



The error i get is JSON data from server could not be parsed.

Any help appreciated.

Thanks,

Replies

  • allanallan Posts: 61,869Questions: 1Answers: 10,137 Site admin
    It looks okay on a quick scan, but the error will be correct. I'd suggest running the return that you see from the server in FireBug through http://jsonlint.com

    Allan
  • johnsamjohnsam Posts: 17Questions: 0Answers: 0
    thanks allan.. i figured it out that that i need to create a table without any data with the th on the columns to be shown... is there any way to load it in div ??
  • allanallan Posts: 61,869Questions: 1Answers: 10,137 Site admin
    Sorry, I'm not quite clear on what you are looking for - do you want to load the table data into a DIV? DataTables works only on TABLE elements. If you want a DIV wrapper, then you need a table inside the div.

    Allan
  • johnsamjohnsam Posts: 17Questions: 0Answers: 0
    Allan, how do I load data table by clicking on the row of existing data table?
  • johnsamjohnsam Posts: 17Questions: 0Answers: 0
    Any idea?????
This discussion has been closed.