简体   繁体   中英

Populating A Kendo UI Grid With A JSON String

I'm using a Kendo UI Grid and can't get it to show data when using a JSON string. I created a fiddle here. What am I doing wrong?

<script type="text/javascript">
    $(document).ready(function ()
    {
        $('#grid').kendoGrid(
        {
            scrollable: false,
            data: '{"TestHeader":"This is some test data"}',
            columns: [ { field: 'TestHeader' } ]
        });
    });
</script>
<div id="grid"></div>

This might be closer to what you want (note the changes to the data definition):

$(document).ready(function ()
{
    $('#grid').kendoGrid(
    {
        scrollable: false,
        dataSource: { data: [ { "TestHeader": "This is some test data"} ] },
        columns: [ { field: 'TestHeader' } ]
    });
});​

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM