Categories | Question details Back To List | ||
Loading a CSV file into the grid. Hey, I have been trying to load data from a CSV file into my grid. There are over 40,000 columns so I created my own for testing purposes. For some reason I cannot get the CSV to load. Here is my HTML. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Simple dhtmlxSuite</title> <!-- Step 1. Include JavaScript and stylesheet for grid --> <link rel="STYLESHEET" type="text/css" href="codebase/dhtmlxgrid.css"> <script src="codebase/dhtmlxcommon.js"></script> <script src="codebase/dhtmlxgrid.js"></script> <script src="codebase/dhtmlxgridcell.js"></script> <script src="codebase/dhtmlxgrid_nxml.js"></script> </head> <body> <h1>Simple dhtmlxSuite</h1> <!-- Step 2. Where to display the grid. --> <div id="gridbox" width="835px" height="500px" style="background-color:lightgrey;overflow:hidden"></div> <!-- Step 3. Setup the JavaScript object. --> <script> mygrid = new dhtmlXGridObject('gridbox'); mygrid.init(); mygrid.loadCSV("test1.csv"); </script> </body> </html> And in my csv file i have tried using no spaces after commas, and vice versa. Please help! Answer posted by Support on Mar 28, 2008 16:00 You need to define grid structure before loading data from CSV, at least headers, column types and column widths mygrid = new dhtmlXGridObject('gridbox'); mygrid.setHeader(... mygrid.setColTypes(... mygrid.setInitWidths(... mygrid.init(); mygrid.loadCSV("test1.csv"); or enable mode, when grid headers build based on first row in CSV file mygrid = new dhtmlXGridObject('gridbox'); mygrid.enableCSVHeader(); mygrid.loadCSV("test1.csv"); |