Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Rob Stanford on Dec 03, 2008 11:13
open dhtmlx forum
First record not included in grid for ajax job

I am loading a grid like this:

mygrid.csv.cell = "|";
mygrid._csvAID=false;
mygrid.load("http://swdev01/nlhtml15/tmp/00000000.grid1.csv","csv");
mygrid.setSizes();

Then, there is a "refresh" option we've created which outputs the same exact file, but we want to use ajax to load it. I'm doing it like this:

var url = "http://ajaxurl";
dhtmlxAjax.get(url,doLoadGrid);             

function doLoadGrid(loader){
var response = loader.xmlDoc.responseText;
mygrid.csv.cell = "|";
mygrid._csvAID=false;
mygrid.enableCSVHeader(false);
mygrid.parse(response,"csv");
mygrid.setSizes();
}

All works fine - except... the first record in the file is never included in the grid when loaded via ajax. Because of this, I tried to include the enableCSVHeader line to remedy the situation, but it doesn't make a difference. Can you tell me what I'm doing wrong?

Thanks,
Rob
Answer posted by Support on Dec 04, 2008 02:29
The code, which you are using seems correct ( cvsHeader is disabled by defautl , so it must not affect data loading ) 
Are you deleting old data in grid before reloading new one? If not , please try to add next line to your code
   mygrid.clearAll();
   mygrid.parse(response,"csv");

If issue still occurs - please provide a sample of problematic CSV data ( you can attach it to the post, or send directly to support@dhtmlx.com
Answer posted by Rob Stanford on Dec 04, 2008 06:57
Actually, I was doing a "mygrid.clearAll();" call, but I was using "false" as a parameter.  I changed it to be exactly what you suggested, but get no different results.  I've attached a sample .csv file.  Let me know if you need anything else.

Rob

Attachments (1)
Answer posted by Support on Dec 05, 2008 02:35
Somehow uploaded file is not accessible ( probably some error occurs during upload ), please send it directly to support@dhtlmx.com