开发者

slickgrid: simple grid render error

I'm trying to use slickgrid to render a very simple table and the result is unexpected. Here is the code:

<script> 

    var grid;

    var columns = [
        {id:"id", name:"ID", field:"id"},
        {id:"a", name:"A", field:"a"},
        {id:"b", name:"B", field:"b"}
    ];

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

    $(function() {
            var data = [];
            data[0] = {
                id: "1",
                a: "1",
                b: "1" };
            data[1] = {
                id: "2",
                a: "2",
                b: "2" };

               grid = new Slick.Grid("#myGrid", data, columns, options);
               $("#myGrid").show(); 

        });

    </script>

Instead of displaying:

| ID | A | B |
| 1  | 1 | 1 |
| 2  | 2 | 2 |

I got

| ID | A | B |
| 1  | 1 |
| 2  | 2 |
开发者_JS百科| 2 |

Could somebody tell me how this could happen?

Thanks


Copied your code and the grid displays correctly for me. Maybe you should check your jQuery and SlickGrid versions?

Here's the HTML I am using.

  <table width="100%">
    <tr>
      <td valign="top" width="50%">
        <div id="myGrid" style="width: 600px; height: 500px;">
        </div>
      </td>
      <td valign="top">
        <h2>
          Demonstrates:</h2>
        <ul>
          <li>SlickGrid</li>
        </ul>
      </td>
    </tr>
  </table>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜