Freeze Panes/ Freeze Columns not working

Hi,

The freezing of columns has stopped working on my Xamarin.iOS application.

Questions:

1. This code was written to simulate the look of Stacked Headers -  which is a feature that's not released for Sfdatagrid iOS yet I believe. Is there some way to do it?

2. Why does the FrozenColumnsCount not work when I manually generate all the columns and set up the sfdatagrid - in the given example below

namespace iOS.App
{
    public partial class StackedHeaderGridViewController : UIViewController
    {
        SfDataGrid _dataGrid;
        SfDataGrid _dataGrid2;
        UISlider slider;

        public StackedHeaderGridViewController() : base("StackedHeaderGridViewController"null)
        {
            _dataGrid = new SfDataGrid();
            _dataGrid.HeaderRowHeight = 45;
            _dataGrid.RowHeight = 45;
            _dataGrid.DefaultColumnWidth = 240;

            _dataGrid2 = new SfDataGrid();
            _dataGrid2.HeaderRowHeight = 45;
            _dataGrid2.RowHeight = 45;

            slider = new UISlider();
        }

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

        }

        public void GenerateTable1()
        {
            _dataGrid.AutoGenerateColumns = false;
            _dataGrid.FrozenColumnsCount = 3;

            GridTextColumn cnameColumn = new GridTextColumn();
            cnameColumn.MappingName = "ContactName";
            cnameColumn.HeaderText = "Contact Name";
            cnameColumn.Width = 240;

            GridTextColumn laborCategoryColumn = new GridTextColumn();
            laborCategoryColumn.MappingName = "LaborCategory";
            laborCategoryColumn.HeaderText = "Labor Category";
            laborCategoryColumn.Width = 240;

            GridTextColumn projectNameColumn = new GridTextColumn();
            projectNameColumn.MappingName = "ProjectName";
            projectNameColumn.HeaderText = "Project name";
            projectNameColumn.Width = 240;

            GridTextColumn MStColumn = new GridTextColumn();
            MStColumn.MappingName = "MST";
            MStColumn.HeaderText = "ST";
            MStColumn.Width = 60;

            GridTextColumn MOtColumn = new GridTextColumn();
            MOtColumn.MappingName = "MOT";
            MOtColumn.HeaderText = "OT";
            MOtColumn.Width = 60;


            GridTextColumn MDtColumn = new GridTextColumn();
            MDtColumn.MappingName = "MDT";
            MDtColumn.HeaderText = "DT";
            MDtColumn.Width = 60;

            GridTextColumn MPdColumn = new GridTextColumn();
            MPdColumn.MappingName = "MPD";
            MPdColumn.HeaderText = "PD";
            MPdColumn.Width = 60;

            GridTextColumn TStColumn = new GridTextColumn();
            TStColumn.MappingName = "TST";
            TStColumn.HeaderText = "ST";
            TStColumn.Width = 60;

            GridTextColumn TOtColumn = new GridTextColumn();
            TOtColumn.MappingName = "TOT";
            TOtColumn.HeaderText = "OT";
            TOtColumn.Width = 60;

            GridTextColumn TDtColumn = new GridTextColumn();
            TDtColumn.MappingName = "TDT";
            TDtColumn.HeaderText = "DT";
            TDtColumn.Width = 60;

            GridTextColumn TPdColumn = new GridTextColumn();
            TPdColumn.MappingName = "TPD";
            TPdColumn.HeaderText = "PD";
            TPdColumn.Width = 60;

            _dataGrid.Columns.Add(cnameColumn);
            _dataGrid.Columns.Add(laborCategoryColumn);
            _dataGrid.Columns.Add(projectNameColumn);

            _dataGrid.Columns.Add(MStColumn);
            _dataGrid.Columns.Add(MOtColumn);
            _dataGrid.Columns.Add(MDtColumn);
            _dataGrid.Columns.Add(MPdColumn);

            _dataGrid.Columns.Add(TStColumn);
            _dataGrid.Columns.Add(TOtColumn);
            _dataGrid.Columns.Add(TDtColumn);
            _dataGrid.Columns.Add(TPdColumn);

            _dataGrid.FrozenColumnsCount = 3;

        }

        public void GenerateTable2()
        {
            _dataGrid2.AutoGenerateColumns = false;

            GridTextColumn monday = new GridTextColumn();
            monday.MappingName = "Monday";
            monday.HeaderText = "Monday";
            monday.Width = 240;

            GridTextColumn tuesday = new GridTextColumn();
            tuesday.MappingName = "Tuesday";
            tuesday.HeaderText = "Tuesday";
            tuesday.Width = 240;

            _dataGrid2.Columns.Add(monday);
            _dataGrid2.Columns.Add(tuesday);

            //_dataGrid2.FrozenColumnsCount = 2;

        }

        void Slider_ValueChanged(object sender, EventArgs e)
        {
            _dataGrid.ScrollToColumnIndex((int)(slider.Value + 3));
            _dataGrid2.ScrollToColumnIndex((int)(slider.Value / 2));

        }

        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            GenerateTable1();
            GenerateTable2();

            UIView bg = new UIView();
            bg.Frame = new CGRect(330150,1024700);
            _dataGrid2.Frame = new CGRect(330,150, bg.Frame.Width, bg.Frame.Height);
            bg.Add(_dataGrid2);
            View.AddSubview(bg);

            slider.MinValue = 1;
            slider.MaxValue = 15;
            slider.Value = 1;
            slider.ValueChanged += Slider_ValueChanged;

            UIView tg = new UIView();
            tg.Frame = new CGRect(01651024700);
            _dataGrid.Frame = new CGRect(0165, tg.Frame.Width, tg.Frame.Height);
            tg.Add(_dataGrid);
            tg.Add(slider);
            View.AddSubview(tg);

        }

        public override void ViewDidDisappear(bool animated)
        {
            base.ViewDidDisappear(animated);
        }



        public override void DidReceiveMemoryWarning()
        {
            base.DidReceiveMemoryWarning();
            // Release any cached data, images, etc that aren't in use.
        }

        
        void AddGridViewToParentView(UIViewController gridView, UIView parentView)
        {
            if (!this.IsReleased() && this != null && gridView != null && parentView != null)
            {
                gridView.View.Frame = parentView.Bounds;
                AddChildViewController(gridView);
                parentView.AddSubview(gridView.View);
                gridView.DidMoveToParentViewController(this);

                gridView.View.AttachToParent();
                View.SetNeedsLayout();
            }
        }
    }
  

1 Reply

SK Shivagurunathan Kamalakannan Syncfusion Team December 5, 2017 02:33 PM UTC

  
Hi Sudharshan, 
 
Thanks for contacting Syncfusion support. 
 
We have analyzed your query. It is recommendable that the sum of the FrozenColumnCount width must be less than the width of the view, So that the non-frozen columns will be visible. If the FrozenColumnCount width is equal or greater than the width of the view, then the scrolling of non-frozen columns does not gets in the view and the FrozenColumnCount must be less than the total column count in the view. We have checked your code example and you have the Gridcolumn width as 240 for the frozen columns, So we cannot able to predict about your device details, please share your device details, that would be helpful to confirm the reported FrozenColumn issue. 
 
Kindly refer the below link for more details: 
 
 
Regards, 
Shivagurunathan. K 


Loader.
Up arrow icon