Click on nested control in GridStackedHeaderDescriptor

Hi team,

I am working on an application containing a programmatically added GridGroupingControl. In the GridStackedHeaderDescriptor we add a custom UserControl with three input fields. When I hover over either of the input fields the application does not seem to register I can select any of them. I first have to click the cell before I can click any of the inputs.


Is there a way to ensure that I can hover over - and click on - any of the top inputs without first having to click the cell?


Image_2567_1728007269978


6 Replies

SP Sreemon Premkumar Muthukrishnan Syncfusion Team October 4, 2024 05:45 PM UTC

Hi Tim Claassens,


We are currently validating the reported issue where you are unable to directly hover over or click on input fields or textboxes without first selecting the cell. We are working on this on our end and will provide you with further details on or before October 8, 2024.

In the meantime, to clarify, could you please provide a video demonstrating the replication of the issue? Additionally, could you confirm whether you have loaded a custom user control that uses three textboxes (with two disabled), along with a TextBlock and a Checkbox, in the StackedHeader of the GridGroupingControl?

We appreciate your patience during this process.


Regards,
Sreemon Premkumar M.



SP Sreemon Premkumar Muthukrishnan Syncfusion Team October 8, 2024 03:19 PM UTC

Hi Tim Claassens,


Sorry for the inconvenience caused.

To validate this further, we need some information regarding the implementation code of the stacked header, including its settings and properties for loading the user control, as well as its structure. Additionally, could you please provide a video demonstrating the replication of the issue?

This information will help us validate the issue further and provide a solution as soon as possible.


Regards,
Sreemon Premkumar M.



TC Tim Claassens October 9, 2024 11:05 PM UTC

Hi Sreemon,


Please find the requested information below.


The grid is initiated here


private void InitializeGrid(GridGroupingControl ggc, bool preserveEvents = false)
        {
            InitStackedHeaders(ggc);


            ggc.TableModel.Options.AllowDragSelectedCols = false;
            ggc.TableModel.Options.AllowDragSelectedRows = false;
            ggc.TableModel.Options.ResizeColsBehavior = GridResizeCellsBehavior.None;
            ggc.TableModel.Options.ResizeRowsBehavior = GridResizeCellsBehavior.None;


            ggc.PrintRowHeader = true;
            ggc.TableDescriptor.AllowEdit = true;
            ggc.ShowRowHeaders = true;
            ggc.ShowColumnHeaders = true;
            ggc.TopLevelGroupOptions.ShowCaption = false;
            ggc.NestedTableGroupOptions.ShowCaption = true;
            ggc.NestedTableGroupOptions.ShowColumnHeaders = false;
            ggc.NestedTableGroupOptions.ShowAddNewRecordAfterDetails = false;
            ggc.NestedTableGroupOptions.ShowAddNewRecordBeforeDetails = false;
            ggc.TopLevelGroupOptions.ShowAddNewRecordAfterDetails = false;
            ggc.TopLevelGroupOptions.ShowAddNewRecordBeforeDetails = false;
            ggc.TopLevelGroupOptions.ShowColumnHeaders = false;
            ggc.TableOptions.AllowSelection = GridSelectionFlags.None;
            ggc.TableOptions.ListBoxSelectionCurrentCellOptions =
                GridListBoxSelectionCurrentCellOptions.HideCurrentCell;
            ggc.TableOptions.ListBoxSelectionMode = SelectionMode.One;
            ggc.TableOptions.ColumnHeaderRowHeight = 228;
            ggc.TableControlQueryAllowDragColumn += (sender, args) => { args.AllowDrag = false; };


            ggc.DataSource = Presenter.DataSet;
            ggc.DataMember = MaterializedViewManager.ISLAND_TABLE_NAME;
            ggc.EnableAutoSize = true;


            cboInstructionType.DataSource = _presenter.InstructionTypeDataTable;
            // txtInstructionValue.MinimumValue = 0;


            cboInstructionType.SelectedIndexChanged += (sender, args) =>
            {
                var newInstruction =
                    (DemandAllocationInstructionTypes)Convert.ToInt32(cboInstructionType.SelectedValue);
                DemandAllocationTpColumnHeaderPanel.SetCurrentInstructionType(newInstruction);
                grid.Refresh();
            };


            if (!preserveEvents)
            {
                AddColumnSynchronizationHandler(ggc);
                AddUserChangeValueHandler(ggc);


                ggc.TableDescriptor.QueryCellStyleInfo += OnDrawSectionBorder;
                ggc.QueryCellStyleInfo += OnDynamicFormatting;
            }


            foreach (var relation in _presenter.ActiveRelations)
            {
                ggc.GetTableDescriptor(relation).QueryCellStyleInfo += OnDynamicFormatting;
                ggc.GetTableDescriptor(relation).QueryCellStyleInfo += OnDrawSectionBorder;
            }


            AddTableColumns(ggc);


            InitTpPeriods(ggc, Presenter.RegisteredMktPeriods);


            foreach (var column in ggc.TableDescriptor.VisibleColumns) ResizeVisibleColumn(column.Name);


            // If we collapse the division section we need to ensure sections are correctly ordered
            if (!Presenter.ShowDivision)
            {
                ggc.GetTableDescriptor(MaterializedViewManager.ISLAND_COMPANY_RELATION_NAME)
                    .SortedColumns.Add(DemandAllocationDataTable.CompanyNameColumnName);
                ggc.GetTableDescriptor(MaterializedViewManager.COMPANY_GXP_RELATION_NAME)
                    .SortedColumns.Add(DemandAllocationDataTable.PNodeNameColumnName);
            }
        }

The headers are initialised here

private void InitTpPeriods(GridGroupingControl ggc, List<DateTime> mktPeriods)
        {
            // Add columns for TP
            var descriptor = ggc.TableDescriptor;


            DemandAllocationTpColumnHeaderPanel.ClearExistingPanels();


            foreach (var mktPeriod in mktPeriods)
            {
                AddTpColumns(mktPeriod, descriptor);


                // add columns to all tables (include nested ones)
                foreach (var relation in _presenter.ActiveRelations)
                {
                    AddTpColumns(mktPeriod, ggc.GetTableDescriptor(relation));
                }


                var tpColumns = new[]
                {
                    new GridStackedHeaderVisibleColumnDescriptor(
                        DemandAllocationDataTable.TP_FORECAST_LOAD_COLUMN_NAME(mktPeriod)),
                    new GridStackedHeaderVisibleColumnDescriptor(
                        DemandAllocationDataTable.TP_SHED_MW_COLUMN_NAME(mktPeriod)),
                    new GridStackedHeaderVisibleColumnDescriptor(
                        DemandAllocationDataTable.TP_LOAD_LIMIT_COLUMN_NAME(mktPeriod))
                };


                // mark columns belonging to TP
                var gsh = new GridStackedHeaderDescriptor("TP " + mktPeriod, mktPeriod.ToString(), tpColumns);


                var header = new DemandAllocationTpColumnHeaderPanel(mktPeriod, this);
                header.OnInputBoxesChanged += () => { _hasPendingCalculation = true; };
                header.LostFocus += (sender, args) => { UpdateEnabledControlState(IsBusy); };
                // header.PopulateForecastValues(period.ForecastLoad, period.PredictedLimit);


                gsh.Appearance.AnyCell.Control = header;
                gsh.Appearance.AnyCell.CellType = GridCellTypeName.Control;


                descriptor.StackedHeaderRows[0].Headers.Add(gsh);
                gsh.Appearance.StackedHeaderCell.Enabled = true;
                gsh.Appearance.StackedHeaderCell.Clickable = true;
            }
        }



The custom component does indeed contain three textboxes (of which two disabled) and a checkbox etc.

Please find the video recording attached.


Attachment: Recording20241010_114307_6a4de9b8.zip


SP Sreemon Premkumar Muthukrishnan Syncfusion Team October 10, 2024 04:32 PM UTC

Hi Tim Claassens,


We have implemented the code snippet you shared, and we are currently validating your requirement on our end. We need some time to complete the validation and will update you with further details on or before October 14, 2024.

We appreciate your patience until then.


Regards,
Sreemon Premkumar M.



TC Tim Claassens October 10, 2024 10:43 PM UTC

Hi Sreemon,

Thank you kindly for your efforts.



SP Sreemon Premkumar Muthukrishnan Syncfusion Team October 14, 2024 04:41 PM UTC

Hi Tim Claassens,


Thank you for your patience.

The control inside the cell will be loaded only when the cell is edited. Therefore, there is no direct way to load or display the user control without clicking or editing the cell.


Regards,
Sreemon Premkumar M.



Loader.
Up arrow icon