openpsa / jsgrid

Fork of last jqGrid version before license change
http://openpsa.github.io/jsgrid/
Other
28 stars 12 forks source link

autodetection of remote datatype (xml or json) #66

Closed OlegKi closed 9 years ago

OlegKi commented 9 years ago

It's the copy of some text from the post

The autodetection of datatype seems a good feature at the first point of view, but ... The first problem: There are some existing backend products which makes autodetection of the format based on dataType used in the Ajax request. For example the WebServices of Microsoft (I mean .ASMX) return XML or JSON depend on it. I'm abrade that such systems will return XML in the case. It you would open the URL in web browser then you would see XML instead of JSON. So such autodetection could change the format returned from the server. jqGrid callbacks, custom formatters, cellattr and rowattr just ptrovide the response as the parameter of the callback. So it makes break the existing code. The code of loadComplete: function (data) { ... var rows = data.rows; ...} will not more work because data.rows will be wrong for XML response.

Moreover, what is real use case of the usage of autodetection? One have to know exact format or returned data to create the grid. If one uses repeatitems: false format then the name property (or jsonmap) should exactly corresponds to the input data. To process XML response one have to write frequently another code. So if somebody use url parameter he have to know the format of data. He knows the type of returned data. So why one should not make datatype mandatory for the remote data? Why one should skip the option. So I don't understand the real case of the usage of autodetection of the format of the server response. I see more disadvantages in the implementation of the feature as advantages.

bouks commented 9 years ago

If people can pay for microsoft licence, he can pay someone to adapt grid to miscrosoft products...

The advantage of autodetection is to make the usage of grid simpler for users. The less you have ton config, the better.

"One have to know exact format or returned data to create the grid." Why ? The software can tell us... If someone need some specific things in the format, he can use xxxReader options.

What's the deal with loadcomplete ?

smartcorestudio commented 9 years ago

I think that every developer knows the data format that he use. So I don't see any problem with this. But I think that some of new users can think: "Why should I tell this stupid software what format it will use. Is it too stupid to see it itself? So why does it require one extra config line from me? And what will be if I just forget to add this config?". Maybe it's somethind like this: when I open, for example, a PDF file I know that it's PDF, but I can just click on it and "smart" computer opens it in associated application. I don't HAVE TO tell every time what to do with this file, but if I WANT I CAN do it.

meh-uk commented 9 years ago

Is this done?

bouks commented 9 years ago

See discussion here: https://github.com/openpsa/jsgrid/issues/46