Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by dlaunay on Dec 15, 2008 09:10
open dhtmlx forum
comma in header text

Hi,
I have a problem with header text.

I load the header with grid.loadXMLString(), and it creates 4 columns instead 2.
I identified the cause : "the comma in the text".

<?xml version="1.0" encoding="UTF-8"?>
<rows>
    <head>
        <column id="column1" width="400" type="ed" align="left" sort="na">column, 1</column>
        <column id="column2" width="100" type="ed" align="center" sort="na">column, 2</column>
    </head>
</rows>

I need to display comma in header text. Is there a solution to display a comma in header text?

best regards.
dlaunay

Answer posted by Support on Dec 15, 2008 09:25
In case of loading data from XML you can use the next kind of escaping

<?xml version="1.0" encoding="UTF-8"?> 
<rows> 
  <head> 
  <column id="column1" width="400" type="ed" align="left" sort="na">column\, 1</column> 
  <column id="column2" width="100" type="ed" align="center" sort="na">column\, 2</column> 
  </head> 
</rows>

Attachments (1)
Answer posted by dlaunay on Dec 16, 2008 00:31
Hi,
   Thanks for your response, but it doesn't solve my problem.
   When I use loadXML method, it works fine! But it doesn't work when i use loadXMLString method.

   Attach, please take a look on my example.

Best regards.
Attachments (1)
mydemo.zip96.71 Kb
Answer posted by Support on Dec 16, 2008 02:05
In case of loading directly from js string - you need to use double escaping ( because js threates the \n sequences as java-script escaping and resolve them even before data loaded in grid ) 
  mygrid.loadXMLString('<?xml version="1.0" encoding="UTF-8"?><rows><head><column id="column1" width="400" type="ed" align="left" sort="na">column\\,1</column><column id="column2" width="100" type="ed" align="center" sort="na">column\\,2</column></head></rows>');