Javascript, jqGrid and XML

For a long time, programming languages seemed to be getting easier and easier. We seemed to be on the brink of realizing that long sought promise of object oriented components: Chunks of code that folks could easily combine to create applications without lots of formal training in computer languages.

Then along came javascript.

I’ve been dabbling with jqGrid, which is a wonderful tool, don’t get me wrong. But I attempted to created a grid with this block of code:

        function initGrid() {
            jQuery("#ganttedit").jqGrid({
                colNames: ['id', 'description', 'start', 'end', 'indicator'],
                colModel: [
                    { name: 'id', index: 'id', width: 55 },
                    { name: 'description', index: 'description', width: 90 },
                    { name: 'start', index: 'start', width: 100 },
                    { name: 'end', index: 'end', width: 80, align: "right" },
                    { name: 'indicator', index: 'indicator', width: 80, align: "right" },
                ],
                viewrecords: true,
                width: 780,
                height: 200,
                rowNum: 30,
                loadonce: true
            });
        }

And got this error message in the console of the brower’s “debug” view (in the browser itself, the grid simply did not render).

XML5656: Illegal qualified name character. Line: 197, Column 32

Given that error message, what do you think might be wrong with the above jqGrid declaration?

I looked at it for a few minutes, googled XML5656 (which didn’t help) then took another look and decided that I was missing a “datatype” parameter in the jqGrid declaration.

Sure enough, when I added datatype:local just above colNames the grid rendered successfully.

I guess I’ve just been spoiled by Visual Studio where concise and informative error messages often appear almost before I’ve typed the bit of offending code.

Written by

41   Posts

View All Posts

Leave a Reply