网格视图 ext.net 二维数组



>我有一个二维数组

        for (int i = 0; i < rowList.GetLength(0);  i++)
        {
            for (int j = 0; j < rowList.GetLength(1); ++j)
            {
                System.Diagnostics.Debug.WriteLine(rowList.GetValue(i,j));
            }
        }

如何在ext.net gridPanel中显示此信息

我在 aspx 页面中有这样的代码:

      <ext:GridPanel ID="GridPanel1" runat="server" Title="SLA-Einhaltung gesamt in % (Basis) " Height="200" Width="800" Frame="true">
        <Store>
            <ext:Store runat="server" ID="Store1">
                <Model>
                    <ext:Model runat="server" IDProperty="ModelID">
                        <Fields>
                            <ext:ModelField Name="SLA_typ"></ext:ModelField>
                        </Fields>
                    </ext:Model>
                </Model>
            </ext:Store>
        </Store>
        <ColumnModel runat="server">
            <Columns>
                <ext:Column runat="server" DataIndex="SLA_typ" Width="120" Text="Tittle"></ext:Column>
            </Columns>
        </ColumnModel>
      </ext:GridPanel>

我对 ext.net gridPanel一无所知。但我查了一下,发现样本 http://examples.ext.net/#/GridPanel/ArrayGrid/Simple/该示例使用交错数组,而不是二维数组。交错数组是数组的数组。

我在使用 WPF 网格时遇到了同样的问题,解决方案是创建一个锯齿状数组。所以我会尝试一个锯齿状数组。这就是从rowList数组创建交错数组的方法。

object [][] jagged = new object[rowList.GetLength(0)][];
    for (int i = 0; i < rowList.GetLength(0);  i++)
    {
        jagged[i] = new object[GetLength(1)];
        for (int j = 0; j < rowList.GetLength(1); ++j)
        {
           jagged[i][j] = rowList[i,j];
        }
    }

最新更新