You have to start somewhere so I opted to use DHTMLX to build a simple CSV file editor. The CSV files I am going to edit are TAB delimited text files. Each file has a fixed number of columns with column names in the first row. Here is an example TAB delimited file. The idea is to load the file data into the grid. Tweak a few rows and save the result. By increasing the size of the CSV file we can gauge the performance of the grid. Let’s get started.
Using the DHTMLX grid requires some preparation.
- Create a local directory and edit J’s ~config/folders.cfg to reference the directory with the name GridDemo. jpath ‘~GridDemo’ should return the full directory path.
- Download the files in the GridDemo folder and copy them to ~GridDemo.
- Download the Standard Edition (Version 3.5) of DHTMLX. The distribution file dhtmlxGrid.zip contains the grid source and supporting files.
- Extract the /dhtmlxGrid/codebase/ directory from dhtmlxGrid.zip and copy the entire directory tree to ~GridDemo.
- Also extract /dhtmlxGrid/samples/common/ from dhtmlxGrid.zip and copy the directory to ~GridDemo.
When you’re finished the top-level of ~GridDemo will look like the following where names without extensions are directories.
calendar dhtmlxgrid.js GridDemo.ijs common dhtmlxgrid_skins.css imgs dhtmlxcommon.js excells jodoval.png dhtmlxgridcell.js ext skins dhtmlxgrid.css favicon.ico t1000rows.txt t100rows.txt t5000rows.txt
The main J script is ~GridDemo\GridDemo.ijs. Start JHS and load this file.
Then browse to this site.
If all goes well you will see the following GridDemo page after pressing the Edit Grid button.
Three test files t100rows.txt, t1000rows.txt, and t5000rows.txt are included with the demo. On my test machines load times vary from fractions of a second for the smaller files to nine seconds for the largest. This is competitive with the basic C# grid control and fast enough for serious work.