Problems while using datatables locally
Problems while using datatables locally
I am trying to run a little setup where my HTML page will pull data from an XML file and display with all searching and sorting features through datatables. But i am planning to run this html page locally on the computer. Please note this point as my problem belongs here.
Firstly, i wrote some javascript to pull out xml data and create tables from it...
[code]
var x = [];
xmlhttp=new XMLHttpRequest();
xmlhttp.open("GET","author.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
data=xmlDoc.getElementsByTagName("paper");
for(i=0 , l = data.length; i < l ; i++)
x.push(data[i]);
sorting(x);
for (i=0;i
Firstly, i wrote some javascript to pull out xml data and create tables from it...
[code]
var x = [];
xmlhttp=new XMLHttpRequest();
xmlhttp.open("GET","author.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
data=xmlDoc.getElementsByTagName("paper");
for(i=0 , l = data.length; i < l ; i++)
x.push(data[i]);
sorting(x);
for (i=0;i
This discussion has been closed.
Replies
I'd suggest trying your test page in Chrome and have a look at the "Inspector" there. The Webkit dev tools will show on the console any files which are getting a 404 error - which is exceptionally useful, particularly for this kind of thing :-)
Allan
I am uploading the files here. Please check them after downloading locally and dont use any web server or anything.
http://www.mediafire.com/?wqba0ras7tl68e5
Now in this i have prepared 2 folders.
1) Is the script which i wrote just to parse data from excel and show it in tabular form. Dont bother about the inefficient code i wrote, i included it just to show that array 'x' contains the proper data. Please note that i observed it later but 'x' is a 1D array. Can you convert it to 2D array? Also, dont try this one in chrome as chrome doesnt allow inclusion of local files.
2) These are the datatables files which i copied from the sub folder to the folder where the page is located and modified the script tag accordingly. This made a lot of difference but still it is not complete. I think it is not properly loading the files from subfolders
Also your $(document).ready function is inside the import_xml function - I'm not sure if this is intentional or not, and you are appending your TR rows to the TABLE, not the TBODY as required by DataTables ( http://datatables.net/usage ).
Here is a modification of that file that works:
[code]
function main()
{
import_xml();
}
function sorting(x)
{
for(i=0, l= x.length;i
Just a few questions and i wont be bugging you anymore :)
1) I want to open some pdf file upon clicking a row, unique for each row and also i want some effects for hover on rows. Can i do this all in my javascript code while i create the rows ??
2) As you might have noticed, there was no styling in the table probably due to the path issue as it is not being able to get the files from within the directory structure. What can i do to add different styles to my table and also i want to change some font styles.