原创

Ext.Net 1.x_Ext.Net.GridPanel合并列头与动态修改列头

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://david.blog.csdn.net/article/details/7446271

合并表头:

              <View>
        <ext:GroupingView>
               <HeaderGroupRows>
                       <ext:HeaderGroupRow>
                              <Columns>
                                  <ext:HeaderGroupColumn ColSpan="2" Header="" Align="Center"  />
                                   <ext:HeaderGroupColumn ColSpan="2" Header="Jan" Align="Center"  />
                                   <ext:HeaderGroupColumn ColSpan="2" Header="Feb" Align="Center"  />
                                   <ext:HeaderGroupColumn ColSpan="2" Header="Mar" Align="Center"  />
                                   <ext:HeaderGroupColumn ColSpan="2" Header="Apr" Align="Center"  />
                                   <ext:HeaderGroupColumn ColSpan="2" Header="May" Align="Center"  />
                                   <ext:HeaderGroupColumn ColSpan="2" Header="Jun" Align="Center"  />
                                   <ext:HeaderGroupColumn ColSpan="2" Header="Jul" Align="Center"  />
                                   <ext:HeaderGroupColumn ColSpan="2" Header="Aug" Align="Center"  />
                                   <ext:HeaderGroupColumn ColSpan="2" Header="Sep" Align="Center"  />
                                   <ext:HeaderGroupColumn ColSpan="2" Header="Oct" Align="Center"  />
                                   <ext:HeaderGroupColumn ColSpan="2" Header="Nov" Align="Center"  />
                                   <ext:HeaderGroupColumn ColSpan="2" Header="Dec" Align="Center"  />
                               </Columns>
                        </ext:HeaderGroupRow>
                 </HeaderGroupRows>
          </ext:GroupingView>
  </View> 


动态修改列头:

    private void ReSetColumnHeader(GridPanel GP) 
    {
        string year = System.DateTime.Now.Year.ToString();
        string last = (System.DateTime.Now.Year -1).ToString();
        this.GPSales.ColumnModel.SetColumnHeader(2, last);
        this.GPSales.ColumnModel.SetColumnHeader(3, year);
        this.GPSales.ColumnModel.SetColumnHeader(4, last);
        this.GPSales.ColumnModel.SetColumnHeader(5, year);
        this.GPSales.ColumnModel.SetColumnHeader(6, last);
        this.GPSales.ColumnModel.SetColumnHeader(7, year);
        this.GPSales.ColumnModel.SetColumnHeader(8, last);
        this.GPSales.ColumnModel.SetColumnHeader(9, year);
        this.GPSales.ColumnModel.SetColumnHeader(10, last);
        this.GPSales.ColumnModel.SetColumnHeader(11, year);
        this.GPSales.ColumnModel.SetColumnHeader(12, last);
        this.GPSales.ColumnModel.SetColumnHeader(13, year);
        this.GPSales.ColumnModel.SetColumnHeader(14, last);
        this.GPSales.ColumnModel.SetColumnHeader(15, year);
        this.GPSales.ColumnModel.SetColumnHeader(16, last);
        this.GPSales.ColumnModel.SetColumnHeader(17, year);
        this.GPSales.ColumnModel.SetColumnHeader(18, last);
        this.GPSales.ColumnModel.SetColumnHeader(19, year);
        this.GPSales.ColumnModel.SetColumnHeader(20, last);
        this.GPSales.ColumnModel.SetColumnHeader(21, year);
        this.GPSales.ColumnModel.SetColumnHeader(22, last);
        this.GPSales.ColumnModel.SetColumnHeader(23, year);
        this.GPSales.ColumnModel.SetColumnHeader(24, last);
        this.GPSales.ColumnModel.SetColumnHeader(25, year);
    }

效果:

文章最后发布于: 2012-04-10 17:04:30
展开阅读全文
0 个人打赏
私信求帮助

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 鲸 设计师: meimeiellie

分享到微信朋友圈

×

扫一扫,手机浏览