Grid load function, JSON, Accept Header


I am currently evaluating your product for potential use on several applications we will be developing. So far things have been going well. However, I did run into one problem with the grid load function and JSON.

We build all of our applications using Ruby on Rails. Rails has automatic detection of the accepted content. This works perfectly with XML calls. However, when we try JSON calls, Rails still thinks the accepted content is XML. I dumped the headers on the back-end and the same Accept header is being sent for XML and JSON. I expected the JSON call to use application/json. I tested that with curl and Rails detects JSON with it.

Is this a bug or do you have a reason for making JSON calls look like XML?

My calls look like this:


mygrid.load("/products/", “json”);

I am using the following release for my evaluation.

dhtmlxSuite 2009 Rel.1 (DHTMLX 2.1) Standard edition build 90226

Thank you.

The component uses common loading routine for all data types, it is just a raw xmlHTTPRequest without any additional headers.
The call uses the same Accept header as for any other HTTP call ( text/html,application/xhtml+xml,application/xml ) - this data is set by a browser itself.

Basically - data loading request doesn’t have any additional info about awaited response type ( it is quite common solution, and part of RESTl ideology, promoted by RoR, that type and content of response fully defined by URL, not by additional headers )

Thanks for the reply.

I was able to get this working using your url suggestion.

For example:
mygrid.load("/products.json", “json”);

That works perfectly.