openpsa / jsgrid

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

Make JSON data viewable in demos #23

Open meh-uk opened 9 years ago

meh-uk commented 9 years ago

As per @flack's comments in pull #17.

well, with enough time and energy, you can implement almost anything :-)

The only drawback I see is that if we're adding some custom handlebar functions to do this is that then the markdown file itself will get less readable, i.e. when you view it in a text editor (or on github). What we could do though is implement this in Javascript and run it on the client side. Bascially intercept the ajax response and print it on screen somewhere.

The code that renders the grid on screen is here:

https://github.com/openpsa/grid.js/blob/master/docs/template/ui.js#L10

It's not very pretty, I know. An implementation idea for intercepting the http response would be to splice some ajaxGridOptions handler into the text read from the codetag. It's a bit of a hack of course, so if you know a cleaner way to do this go right ahead :-)