1

問題: SlickGrid を json データで初期化する方法

私の動作しないコード:

<div id="data">

</div>

<script>
$(document).ready(function(){
    $.ajax({    
        type: "GET",
        url: "<?=Route::url('ajax_list')?>",   
        dataType: 'json',   
        success: function(json) {   

            var grid;

            var columns = [
                {id: "id", name: "Id", field: "id"},
                {id: "code", name: "Kod", field: "code"},
                {id: "type", name: "Typ", field: "type"},
                {id: "height", name: "Wys", field: "height"},
                {id: "width", name: "Szer", field: "width"},
                {id: "in_stock", name: "Stan", field: "in_stock"}
            ];

            var options = {
              enableCellNavigation: true,
              enableColumnReorder: false
            };

            grid = new Slick.Grid("#data", json, columns, options);
        }               
    });
});
</script>

json:

[{"id":"7","code":"C22\/30\/130","type":"0","height":"30","width":"130","in_stock":"34","update_hash":"e8df47c817c8acc9831d4ee27394e955"},{"id":"8","code":"C21\/60\/160","type":"0","height":"60","width":"160","in_stock":"12","update_hash":"e8df47c817c8acc9831d4ee27394e955"},{"id":"9","code":"C21\/90\/120","type":"0","height":"90","width":"120","in_stock":"2","update_hash":"e8df47c817c8acc9831d4ee27394e955"},{"id":"10","code":"C22\/30\/080","type":"0","height":"30","width":"80","in_stock":"1","update_hash":"e8df47c817c8acc9831d4ee27394e955"},{"id":"11","code":"C22\/30\/090","type":"0","height":"30","width":"90","in_stock":"23","update_hash":"e8df47c817c8acc9831d4ee27394e955"},{"id":"12","code":"C22\/30\/100","type":"0","height":"30","width":"100","in_stock":"5","update_hash":"e8df47c817c8acc9831d4ee27394e955"}]

json データで SlickGrid を実行する方法を教えてください。

編集:コンソールエラーはありません。

4

1 に答える 1