set/reload treegrid data with inner html and parse it

Hi,

I made a treegrid (in a dhtmlxlayout) and i try to reload data with httprequest (responsetext in innHTML).
The problem is that i can’t use the xml way, maybe what i’m trying is not possible… I hope you can help me.

Here is my code :

[code]

[...]
[/code]

My httprequest works, it returns in alert the good script with all changes but on the sreen it’s the same, no reload. The only change i see is that i loose my rows images.

Have you got any idea to make it work ?

Thanks for your help.

Why you are returning html with embeded json instead of pure json data for treegrid?

Please be sure that treegrid var was really set to new value, and you are providing new data to the parse command ( init and reload command are correct on its own )

Hi,

Thanks for your answer.

I don’t know why, but I thought it was not possible to init data in treegrid with mygrid.load(url,“json”), so i haven’t try it. :blush:
After your answers, I make it work with this way… :unamused:

So thank you, your answer has help me a lot!!!.

Hi!

I worked on IE9 but trying on IE8, data are not loaded. :frowning:

I use this :

mygrid.load(http://"+url+"&nocache="+(new Date()).valueOf(),"json"); 

Is there something more to do?

Thanks!

Logic is correct, but above line of code has a typo, missed quote

mygrid.load(“http://”+url+"&nocache="+(new Date()).valueOf(),“json”);

Sorry, for the typo, but In my source code it was write good, without typo.

Can you provide a sample of json data for which issue occurs ( please attach it as a file ) ?

Hi,

Find a sample in attachment.

Thanks for your help.
data.zip (452 Bytes)

You have an extra comma at end of array

{ id:'SUB_PRESTA_3',data:["","","","","","","","","",""]}, // <= here it is ]

Thank you!!!

It works better like this. :wink:
Just for a comma…

Thank you very much for your help!

Use JSONLint to validate your JSON

Thanks for the tip!

I will use it!!!