c1Flexgrid Summary button show not correctly

Posted by: levanduyet on 12 August 2024, 10:56 am EST

  • Posted 12 August 2024, 10:56 am EST - Updated 12 August 2024, 11:02 am EST

    Hi,

    I have 2 c1flexgird:

    a. The first one, row fix =1

    b. The second one, row fix=2

    When I group the data, the one with row fix=1, show correctly. Another one show not correctly as attached photo.

    Any solution.

    Thanks,

    Duyet Le

  • Posted 13 August 2024, 5:56 am EST

    Hello,

    Thank you for providing the screenshots.

    We are sorry, but we could not replicate the behavior on our end. We created a sample similar to yours and tested it with the latest 2024v1 version of the FlexGrid. Could you please let us know if we are missing something and the version of FlexGrid you are using on your end? Please test your project with the latest version of FlexGrid as well.

    Could you please update the attached sample or attach a stripped-down version of your sample so that we can observe and investigate the behavior further? (see FlexGrid_BarButton.zip)

    Regards,

    Uttkarsh.

  • Posted 13 August 2024, 8:21 am EST

    Hi Uttkarsh,

    I use .NET 6 and Flexgrid version: 8.0.20241.657

    I have no problem with .net framework 4.8.

    Could you try the above version.

    Thanks,

    Duyet Le

  • Posted 14 August 2024, 1:32 am EST

    Hello,

    Thank you for providing more information but we still are unable to replicate the behavior on our end. We converted our sample to NET6/8 and checked with both 657 and 664 but could not observe the behavior.

    Please let us know if we are missing something and provide us with the FlexGrid-specific code you are using in your project.

    Could you please update the attached sample or attach a stripped-down sample of your project so that we can observe and investigate it further? (see FlexGrid_BarButton_NET8.zip)

    Regards,

    Uttkarsh.

  • Posted 14 August 2024, 11:42 am EST

    Hi Uttkarsh,

    My code is following:

    private void iniFlexgridVatTuChoLsx(Int32 lSoHang)
    {
       
        fgChiTietNvlChoLenhSx.Subtotal(AggregateEnum.Clear);
        fgChiTietNvlChoLenhSx.DataSource = null;
    
        fgChiTietNvlChoLenhSx.Rows.Count = lSoHang;
        fgChiTietNvlChoLenhSx.Cols.Count = 16; 
        fgChiTietNvlChoLenhSx.Rows.Fixed = 2;
        
    
       
        fgChiTietNvlChoLenhSx.AllowSorting = AllowSortingEnum.None;
      
        fgChiTietNvlChoLenhSx.AllowResizing = AllowResizingEnum.Columns;
       
        fgChiTietNvlChoLenhSx.AutoClipboard = true;
        fgChiTietNvlChoLenhSx.ClipboardCopyMode = ClipboardCopyModeEnum.DataOnly;
      
        fgChiTietNvlChoLenhSx.AllowFiltering = false;
        
        fgChiTietNvlChoLenhSx.AllowEditing = false;
      
        fgChiTietNvlChoLenhSx.ColumnPickerInfo.ShowToolButton = false;
    
       
        fgChiTietNvlChoLenhSx.SelectionMode = SelectionModeEnum.Default; 
     
        fgChiTietNvlChoLenhSx.FocusRect = FocusRectEnum.Light;
      
    
        // Cols width
        fgChiTietNvlChoLenhSx.Cols[0].Width = 30;
        fgChiTietNvlChoLenhSx.Cols[1].Width = 150;
        fgChiTietNvlChoLenhSx.Cols[2].Width = 200;
        fgChiTietNvlChoLenhSx.Cols[3].Width = 400;
        fgChiTietNvlChoLenhSx.Cols[4].Width = 150;
        fgChiTietNvlChoLenhSx.Cols[5].Width = 200;
        fgChiTietNvlChoLenhSx.Cols[6].Width = 500;
        fgChiTietNvlChoLenhSx.Cols[7].Width = 100;
        fgChiTietNvlChoLenhSx.Cols[8].Width = 200;
        fgChiTietNvlChoLenhSx.Cols[9].Width = 200;
        fgChiTietNvlChoLenhSx.Cols[10].Width = 200;
        fgChiTietNvlChoLenhSx.Cols[11].Width = 200;
        fgChiTietNvlChoLenhSx.Cols[12].Width = 200;
        fgChiTietNvlChoLenhSx.Cols[13].Width = 200;
        fgChiTietNvlChoLenhSx.Cols[14].Width = 200;
        fgChiTietNvlChoLenhSx.Cols[15].Width = 200;
        //Data type
        fgChiTietNvlChoLenhSx.Cols[1].DataType = typeof(string);//Ma Lsx
        fgChiTietNvlChoLenhSx.Cols[2].DataType = typeof(string);//Ma hang
        fgChiTietNvlChoLenhSx.Cols[3].DataType = typeof(string);//Ten hang
        fgChiTietNvlChoLenhSx.Cols[4].DataType = typeof(double);
        fgChiTietNvlChoLenhSx.Cols[5].DataType = typeof(string);
        fgChiTietNvlChoLenhSx.Cols[6].DataType = typeof(string);
        fgChiTietNvlChoLenhSx.Cols[7].DataType = typeof(string);//Unit name
        fgChiTietNvlChoLenhSx.Cols[8].DataType = typeof(double);
        fgChiTietNvlChoLenhSx.Cols[9].DataType = typeof(double);
        fgChiTietNvlChoLenhSx.Cols[10].DataType = typeof(double);
        fgChiTietNvlChoLenhSx.Cols[11].DataType = typeof(double);
        fgChiTietNvlChoLenhSx.Cols[12].DataType = typeof(double);
        fgChiTietNvlChoLenhSx.Cols[13].DataType = typeof(double);
        fgChiTietNvlChoLenhSx.Cols[14].DataType = typeof(double);
        fgChiTietNvlChoLenhSx.Cols[15].DataType = typeof(double);
    
        #region Định dạng tiêu đề
        //Header filling
        fgChiTietNvlChoLenhSx.Rows[0].AllowMerging = true;
        fgChiTietNvlChoLenhSx.AllowMergingFixed = AllowMergingEnum.FixedOnly;
        for (int i = fgChiTietNvlChoLenhSx.Cols.Fixed; i < fgChiTietNvlChoLenhSx.Cols.Count; i++)
        {
            fgChiTietNvlChoLenhSx.Cols[i].AllowMerging = true;
        }
        CellRange rng = fgChiTietNvlChoLenhSx.GetCellRange(0, 1, 1, 1);
        rng.Data = "Lệnh sản xuất";
    
        rng = fgChiTietNvlChoLenhSx.GetCellRange(0, 2, 1, 2);
        rng.Data = "Mã thành phẩm";
    
        rng = fgChiTietNvlChoLenhSx.GetCellRange(0, 3, 1, 3);
        rng.Data = "Tên thành phẩm";
    
        rng = fgChiTietNvlChoLenhSx.GetCellRange(0, 4, 1, 4);
        rng.Data = "SL thành phẩm định mức";
    
        rng = fgChiTietNvlChoLenhSx.GetCellRange(0, 5, 1, 5);
        rng.Data = "Mã nguyên vật liệu";
    
        rng = fgChiTietNvlChoLenhSx.GetCellRange(0, 6, 1, 6);
        rng.Data = "Tên nguyên vật liệu";
    
        rng = fgChiTietNvlChoLenhSx.GetCellRange(0, 7, 1, 7);
        rng.Data = "Đvt";
    
        rng = fgChiTietNvlChoLenhSx.GetCellRange(0, 8, 1, 8);
        rng.Data = "Số lượng định mức";
    
        rng = fgChiTietNvlChoLenhSx.GetCellRange(0, 9, 0, 11);
        rng.Data = "Số lượng NVL trong kỳ";
        fgChiTietNvlChoLenhSx[1, 9] = "Xuất kho";
        fgChiTietNvlChoLenhSx[1, 10] = "Nhập lại kho";
        fgChiTietNvlChoLenhSx[1, 11] = "Thực tế sử dụng";
    
        rng = fgChiTietNvlChoLenhSx.GetCellRange(0, 12, 0, 14);
        rng.Data = "Số lượng NVL lũy kế";
        fgChiTietNvlChoLenhSx[1, 12] = "Xuất kho";
        fgChiTietNvlChoLenhSx[1, 13] = "Nhập lại kho";
        fgChiTietNvlChoLenhSx[1, 14] = "Thực tế sử dụng";
    
        rng = fgChiTietNvlChoLenhSx.GetCellRange(0, 15, 1, 15);
        rng.Data = "Chênh lệch NVL";
    
        fgChiTietNvlChoLenhSx.Rows[0].TextAlign = TextAlignEnum.CenterCenter;
        fgChiTietNvlChoLenhSx.Rows[1].TextAlign = TextAlignEnum.CenterCenter;
    
        #endregion
    
    }
    private void btnTongHop_Click(object sender, EventArgs e)
    {
    
        this.Cursor = Cursors.WaitCursor;
        try
        {
                MisaDAL mekongDB = new MisaDAL();
                DataTable dtResult = new DataTable();
                string listProductionOrderID = sb.ToString();
                dtResult = mekongDB.GetMaterialsInOutByProdOrder(dTuNgay, dDenNgay, branchID, listProductionOrderID);
                if (dtResult.Rows.Count > 0)
                {
                    this.iniFlexgridVatTuChoLsx(2);
                    int iRun = 1;
                    fgChiTietNvlChoLenhSx.BeginUpdate();
                    foreach (DataRow dtRow in dtResult.Rows)
                    {
                        fgChiTietNvlChoLenhSx.Rows.Add();
                        iRun = fgChiTietNvlChoLenhSx.Rows.Count - 1;//Get last row
                        fgChiTietNvlChoLenhSx[iRun, 1] = dtRow["RefNo"].ToString();
                        fgChiTietNvlChoLenhSx[iRun, 2] = dtRow["ProductionCode"].ToString();
                        fgChiTietNvlChoLenhSx[iRun, 3] = dtRow["ProductionName"].ToString();
                        fgChiTietNvlChoLenhSx[iRun, 4] = dtRow["ProductionQuantity"].ToString();
                        fgChiTietNvlChoLenhSx[iRun, 5] = dtRow["InventoryItemCode"].ToString();
                        fgChiTietNvlChoLenhSx[iRun, 6] = dtRow["InventoryItemName"].ToString();
                        fgChiTietNvlChoLenhSx[iRun, 7] = dtRow["UnitName"].ToString();
                        fgChiTietNvlChoLenhSx[iRun, 8] = dtRow["RequiredQuantity"].ToString();
                        fgChiTietNvlChoLenhSx[iRun, 9] = dtRow["RequiredQuantity"].ToString();
                        fgChiTietNvlChoLenhSx[iRun, 10] = dtRow["RealyQuantity"].ToString();
                        fgChiTietNvlChoLenhSx[iRun, 11] = dtRow["ReturnInwardQuantityInPeriod"].ToString();
                        fgChiTietNvlChoLenhSx[iRun, 12] = dtRow["RealUseInPeriodQuantity"].ToString();
                        fgChiTietNvlChoLenhSx[iRun, 13] = dtRow["AccumulatedQuantityInYear"].ToString();
                        fgChiTietNvlChoLenhSx[iRun, 14] = dtRow["AccumRealUseQuantity"].ToString();
                        fgChiTietNvlChoLenhSx[iRun, 15] = dtRow["DiffQuantity"].ToString();//Diff qty
    
                    }
                    
                    #region Summary
                    fgChiTietNvlChoLenhSx.AllowDragging = AllowDraggingEnum.None;
                    fgChiTietNvlChoLenhSx.AllowEditing = false;
                    fgChiTietNvlChoLenhSx.Tree.Column = 0;
    
                    ////Group 1:
                    ////_ Group level 1
                    ////_ Group at col 1 
                    ////_ Function Count 0 
                    fgChiTietNvlChoLenhSx.Subtotal(AggregateEnum.Count, 1, 1, 0, "Production order: {0}");
                    ////Group 2:
                    ////_ Group level 2
                    ////_ Group col 2
                    ////_ Function Count 0 
                    fgChiTietNvlChoLenhSx.Subtotal(AggregateEnum.Count, 2, 2, 0, "Finished goods code: {0}");
    
                    fgChiTietNvlChoLenhSx.Cols[0].Width = 350;
                    fgChiTietNvlChoLenhSx.Tree.Style = TreeStyleFlags.CompleteLeaf;// | TreeStyleFlags.ButtonBar;
                    fgChiTietNvlChoLenhSx.Tree.Show(1);
                    #endregion
                }
                else
                {
                    MessageBox.Show("There is no data", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            
            #endregion
        }
        catch (Exception ex)
        {
            MessageBox.Show("Error:" + ex.Message, "Info", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
        finally
        {
            fgChiTietNvlChoLenhSx.EndUpdate();
            this.Cursor = Cursors.Default;
        }
    }

    1, Fill the header to flexgrid

    private void iniFlexgridVatTuChoLsx(Int32 lSoHang)

    2, Fill data to flexgrid. This step is okay. (See the first photo)

    3, Group data => problem (See the second photo). I really don’t know why. Could you see my code, is it correct.

    Thanks,

    Duyet Le

  • Posted 15 August 2024, 2:51 am EST - Updated 15 August 2024, 2:56 am EST

  • Posted 16 August 2024, 12:57 am EST

    Hello,

    We apologize for the inconvenience, but we are still unable to observe the behavior on our end. Please refer to the attached sample, which has been updated with the code you provided but could not replicate the behavior.

    Please provide the following information for further investigation:

    1. stripped-down project or updated sample project that shows the behavior on their end. [If your project consists of sensitive information that cannot be shared here on the public forum, please create a new ticket on our private portal.]
    2. a video showing you running the project and observing the behavior.
    3. your machine’s environment details, like OS build, VS build, using RDP/VM, etc.

    Updated sample: FlexGrid_BarButton_NET8_Mod.zip

    Regards,

    Uttkarsh.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels