Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by David Jorgensen on Aug 18, 2008 13:42
open dhtmlx forum
export cvs to Excel with List type

Problem when you use the dhtmlxgrid_nxml.js file that has the Label parameter grid.serializeToCSV(true) with a Link type column.

Loaded Values:

Value of col1: Allianz SE (100146)^javascript:DisplayList("100146");^_Self

Value of col2: Hauser,Heijo

Example: serializeToCSV(true);

Value of col1: javascript:DisplayList("100146");

Value of col2: blank

Example: serializeToCSV(false);

Value of col1: Allianz SE (100146)^javascript:DisplayList("100146");

Value of col2: Hauser,Heijo^

How to export just the display value of the Link column?
Answer posted by Support on Aug 19, 2008 02:19
Add next line before grid init

eXcell_link.prototype.getTitle = eXcell_link.prototype.getContent;

As result the serializeToCSV(true); command , will return content of link, instead of href
Answer posted by David Jorgensen on Aug 19, 2008 10:31

Thanks, It works.

Will the next version have this incorporated, or will I always have to provide this overide?

Answer posted by Support on Aug 20, 2008 02:08
We not plan to provide such change as part of main codebase. Current approach, when getTitle method returns href is logical in most cases.
Answer posted by David Jorgensen on Oct 16, 2008 08:08

Since upgrading to dhtlmx 2008 Rel 3 of grid, the above workaround does not work any more as the serializeToCSV function nolonger accepts a parm.

see code below:

dhtmlXGridObject.prototype.serializeToCSV = function()
  {
   this.editStop()
   if (this._mathSerialization)
    this._agetm = "getMathValue";
   else
    if (this._strictText)
     this._agetm = "getTitle";
    else
     this._agetm = "getValue";
   var out = [];
   if (this._csvHdr)
   {

---------------------------------------

How can I set "this._strictText" to be true so that it will use getTitle instead of getValue?

Thanks

 

Answer posted by Support on Oct 16, 2008 09:22
You can set it directly as 

grid._strictText = true;
var data = grid.serializeToCSV();

>>Since upgrading to dhtlmx 2008 Rel 3 of grid, the above workaround does not work any more as the serializeToCSV 
Regression confirmed , functionality will be restored in next build. 
(Please inform if you need such update ASAP)


Answer posted by David Jorgensen on Oct 16, 2008 13:01

That works

Thanks for the quick response!

I can wait the next build.