Flex Grid Auto Rezize

Posted by: yuvaopens on 22 September 2017, 4:49 am EST

  • Posted 22 September 2017, 4:49 am EST

    Hi All,

    I'm using 6 C1FlexGrids in a form which is one by one below Horizontally. Normally while loading the form I'll get some 50 records in each grid(Height = 250). I can able to refine my search and based on that records displaying in all the 6 grid will be decreased to 4 or 5 in each. I want to Minimize the grid size(Height = 75 or 100) based on the records displaying. is that Feasible? I.e.,


    Records in Grid Height
    2 100
    3 125
    4 150
    5 175

    Maximum Size it can reach is 250
  • Marked as Answer

    Replied 28 September 2017, 1:26 am EST

    Hi,

    For meeting your desired output, you need to first calculate the number of visible rows after filtering grid, for this you may use AfterFilter event. Then set the height of the grid(s) equal to the number of rows times the height of each row, as follows:
     
    Public Function calculateSize(grid As C1FlexGrid, VisibleRows As Integer) As Integer
    If (VisibleRows * grid.Rows.DefaultSize < 100) Then
    Return 100
    ElseIf (VisibleRows * grid.Rows.DefaultSize > 250) Then
    Return 250
    Else
    Return VisibleRows * grid.Rows.DefaultSize
    End If
    End Function



    C1FlexGrid1.Height = calculateSize(C1FlexGrid1, ivisible1)
    C1FlexGrid2.Height = calculateSize(C1FlexGrid2, ivisible2)
    ...

    I have also uploaded a sample application for your reference, which can be downloaded from the following URL: https://www.dropbox.com/s/x0myqq6baj391la/prj_AutoResizeC1FlexGrid.zip?dl=0


    Regards,
    Ruchir Agarwal
Need extra support?

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

Learn More

Forum Channels