Question

I am having a propblem with flexigrid, it fetches the json data but does not populate it. I also don't want to use PHP on the server side, and if possible no server-side programming.

<table id="payments2"></table>

<script>

    $('#payments2').flexigrid({
        url: '/payments.json',
        dataType: 'json',
        colModel: 
                [
                            { display: 'Payment Date', name: 'date', width: 100, sortable: true }
                ]               
        });

</script>
Was it helpful?

Solution

I am just researching this issue myself.

Apparently if you take a look at official site's php that generates the json for the examples, you will see that its not standard JSON.

It has some special format:

{
    "page": 1,
    "total": 2,
    "rows": [
        {
            "id": "ZW",
            "cell": {
                "name": "Zimbabwe ",
                "iso": "ZW",
                "printable_name": "Zimbabwe ",
                "iso3": "ZWE ",
                "numcode": "716"
            }
        },
        {
            "id": "ZM",
            "cell": {
                "name": "Zambia ",
                "iso": "ZM",
                "printable_name": "Zambia ",
                "iso3": "ZMB ",
                "numcode": "894"
            }
        }
           ]
}

Apparently you are returning JSON format that has only the "cells"

You will need to find a way to create this structure in your returned JSON resultset.

I have found an example for ASP .NET MVC that converts it to the proper format : here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top