Hi,
I new to using this. I was trying to load a comma separated format into the grid, however one of my entries has a comma in it and the grid is splitting it at the wrong place. I tried escaping with a \ but that did not work? Is there some other way to escape?
9,<a href=http://uswmapdcprp01:9090/ETTAMRS/GetonesecTrendCharts.jsp?server=MXWXAPSTAP25A>MXWXAPSTAP25A,stamx-ax101-p.ett.amrs.bankofamerica.com,ZVM: 0ZST:0,<a href=http://techinfo.bankofamerica.com/server.php?server=MXWXAPSTAP25A>HOST TECH,<a href=http://techinfo.bankofamerica.com/ait.php?ait=51222>51222<a href=http://techinfo.bankofamerica.com/ait.php?ait=56181>56181,<a href=http://ait.bankofamerica.com/ait/controller/viewApp?appid=51222\,56181>NG-AMRS-DMAEST-LATAM-HOTROD ,MEXICO CITY,None,Engines=[AXM1:PH_AMPS_MEX1]DMA=[AMPS_MEX1:HOMA_MEX1:MA_MEX1],prd
Also, is it possible to do some changes to the incoming data before it is rendered? Above I have some entries that are delimited by : (due to the fact that I couldn’t escape the ,). Can I do a string replace under some overriding function before grid is rendered?
sematik
November 1, 2013, 5:22pm
#2
Please, try to place the value with the comma in quotes:
9,<a href=http://uswmapdcprp01:9090/ETTAMRS/GetonesecTrendCharts.jsp?server=MXWXAPSTAP25A>MXWXAPSTAP25A</a>,stamx-ax101-p.ett.amrs.bankofamerica.com,ZVM: 0</br>ZST:0,<a href=http://techinfo.bankofamerica.com/server.php?server=MXWXAPSTAP25A>HOST TECH</a>,<a href=http://techinfo.bankofamerica.com/ait.php?ait=51222>51222</a></br><a href=http://techinfo.bankofamerica.com/ait.php?ait=56181>56181</a>,"<a href=http://ait.bankofamerica.com/ait/controller/viewApp?appid=51222,56181>NG-AMRS-DMAEST-LATAM-HOTROD</a>",MEXICO CITY,None,Engines=[AXM1:PH_AMPS_MEX1]</br>DMA=[AMPS_MEX1:HOMA_MEX1:MA_MEX1],prd
escaping with quotes doesn’t seem to be working as suggested. are there any config options that need to be set to enable this to work?
The provided solution works well for us.
Unfortunately there is no other way to escape the comma.
OK, so it seems that in order for this to work, every single row needs to have the specified column value enclosed in quotes in the csv output.
Now, my question is, how do you prevent the grid control from displaying these extra quotation characters? Basically, the grid is showing:
columnA | columnB
valueA | “1”
valueB | “2,3,4”
valueC | “4”
…
how do I strip the quotation characters from displaying in the grid? I want it to look like this:
columnA | columnB
valueA | 1
valueB | 2,3,4
valueC | 4
…
I’ve figured out how to get this to work finally using DHTMLxGrid 3.6 but requires changes to source code and also requires an additional CSVToArray function found here: http://stackoverflow.com/questions/1293147/javascript-code-to-parse-csv-data
In the sources/dhtmlxgrid.js file, you need to modify the _process_csv:function
Old:
if (this._csvAID){
var id = i+1;
this.rowsBuffer.push({
idd: id,
data: data[i],
_parser: this._process_csv_row,
_locator: this._get_csv_data
});
} else {
var temp = data[i].split(this.csv.cell);
...
New:
if (this._csvAID){
var id = i+1;
this.rowsBuffer.push({
idd: id,
data: data[i],
_parser: this._process_csv_row,
_locator: this._get_csv_data
});
} else {
var temp = CSVToArray(data[i], this.csv.cell)[0];
...
That has now corrected the problem.