Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Nikolai on Nov 26, 2009 01:16
open dhtmlx forum
WEIRD problem. Really weird

I have the following problem. Maybe you wont believe but it is true.

in my xml file i have two hidden columns that have latitude and longtitude coordinates. My grid table have the following logic:

1 row indicates movement hours of a vehicle, 1 row how long the engine was off but i do not know if the grid starts with row indicating movement or rest because it is generated from the server with very complicated logic. That's why i have created two hidden columns and the rows that indicate movement i decided to put in the latitude/longtiude columns the word "k" and the rows indicating that engine is off the coordinates.

So when i decided to iterate the grid with javascript code i had to check if the current row is indicating movement or rest and i used the following code:

var blabla = mygrid.cells(x,y).getValue();
window.alert(blabla) <---- shows the word 'k' as espected.

But when i do this. window.alert(blabla.length) < ---- shows that the length is 3 ( THREE ) WTF????

and this one if(blabla == 'k' ) doReverseGeocoding() does not work because it says that the value in the cell is not equal to 'k' no matter that when i print it it shows 'k'


then i decided in my xml to change the word 'k' with the word 'kkk' and when i print its length

window.alert(blabla.length) <--- this time it shows 5 ( FIVE )

in both cases the length of the word is with TWO letters more!!!!

BUt when i print it window.alert(blabla) it shows what is expected 'kkk'


Any solution to this?
Answer posted by Stanislav (support) on Nov 26, 2009 01:27
Do you have in the XML
     <cell>k</cell>
or 
     <cell>k
     <cell>

In second case the new line chars may be preserved and you will have "k\r\n\" as cell value. Two last are not visible but will affect length and comparison..