Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
120
Multi-Column Header with ServerOnly problem.
posted

Hi I'm in trouble with Multi-Column.

The datasource for grid has 7 columns and first 'Identity' column is ServerOnly = true, and 'Identity2', 'Name' header of columns is single header, and the header of rest columns is multi. When I set Hidden=true instead of ServerOnly=true, it worked collectly. But ServerOnly=true, it shows me strange. What is wrong with this. 

Here is my test code

void UltraWebGrid_InitializeDataSource(object sender, UltraGridEventArgs e)
    {
       
        DataTable table = new DataTable("table");
        table.Columns.Add("ID");
        table.Columns.Add("NAME");
        table.Columns.Add("SCORE");
        table.Columns.Add("ADDR");
        table.Columns.Add("PHONE");
        for (int i = 0; i < 40; i++)
        {
            DataRow row = table.NewRow();
            row["ID"] = i;
            row["NAME"] = (char)(i + 65);
            row["SCORE"] = (i < 3) ? 30 : (i < 6) ? 60 : 100;
            row["ADDR"] = "Dobong-gu Seoul";
            row["PHONE"] = "000-0000-1234";

            table.Rows.Add(row);
        }

        ((UltraWebGrid)sender).DataSource = table;
    }

private void SetColumn() {       
        UltraWebGrid1.Bands[0].HeaderLayout.Clear();
        UltraWebGrid1.Columns.Clear();
        UltraGridColumn col;
        col = GetNewColumn("ID1", "ID", "Identity1");
        col.Width = new Unit(50); col.ServerOnly = true;
        UltraWebGrid1.Columns.Add(col);

        col = GetNewColumn("ID2", "ID", "Identity2");
        col.Width = new Unit(50);
        UltraWebGrid1.Columns.Add(col);

        col = GetNewColumn("NAME", "NAME", "Name");
        col.Width = new Unit(50);
        UltraWebGrid1.Columns.Add(col);

        col = GetNewColumn("SCORE", "SCORE", "Score");
        col.Width = new Unit(50);
        UltraWebGrid1.Columns.Add(col);

        col = GetNewColumn("ADDR", "ADDR", "Addr");
        col.Width = new Unit(100);
        UltraWebGrid1.Columns.Add(col);

        col = GetNewColumn("PHONE1", "PHONE", "Phone1");
        col.Width = new Unit(100);
        UltraWebGrid1.Columns.Add(col);

        col = GetNewColumn("PHONE2", "PHONE", "Phone2");
        col.Width = new Unit(100);
        UltraWebGrid1.Columns.Add(col);

        UltraWebGrid1.Bands[0].FilterOptions.AllowRowFiltering = RowFiltering.OnServer;
        UltraWebGrid1.Bands[0].FilterOptions.RowFilterMode = RowFilterMode.SiblingRowsOnly;
    }
    private UltraGridColumn GetNewColumn(string key, string basecolname, string caption) {
        UltraGridColumn col = new UltraGridColumn();
        col.Header.Style.HorizontalAlign = HorizontalAlign.Center;
        col.Key = key; col.BaseColumnName = basecolname; col.Header.Caption = caption;
        return col;
    }
    private void SetMultiColumn() {
        int multistartindex = 3;
        for (int i = 0; i < UltraWebGrid1.Columns.Count;i++ ) {
            UltraGridColumn c = UltraWebGrid1.Columns[i];
            c.Header.RowLayoutColumnInfo.OriginY = 1;

            if (i >= multistartindex) {
                c.Header.RowLayoutColumnInfo.SpanY = 1;
            }
            else {
                c.Header.RowLayoutColumnInfo.OriginY = 0;
                c.Header.RowLayoutColumnInfo.SpanY = 2;
            }
        }

        ColumnHeader ch = new ColumnHeader(true);
        ch.Caption = "Operating Temperature";
        ch.Style.HorizontalAlign = HorizontalAlign.Center;
        ch.RowLayoutColumnInfo.OriginX = multistartindex-1;
        ch.RowLayoutColumnInfo.OriginY = 0;       
        UltraWebGrid1.Bands[0].HeaderLayout.Add(ch);
        ch.RowLayoutColumnInfo.SpanX = 4;
    }