We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Hiding first column in the grid set''s the focus on Row header and causes problems

Thread ID:

Created:

Updated:

Platform:

Replies:

67572 Aug 23,2007 03:18 PM Aug 31,2007 04:12 PM Windows Forms 4
loading
Tags: GridControl
Pratima
Asked On August 23, 2007 03:18 PM



Hi,
I am using Syncfusion GDBG 4.402.0.51 version.

Here is the simple case.

I an binding my grid to the datasource which let's say has 4 columns.
Once the grid is bound, I am hiding the very first column which in my case happens to be a autogenerated primary key column which I don't need to show users.

Problem:
When the grid is displayed the focus is on the row header column.
I use down/Up arrow keys and the focus doesn't show but it is actually on the hidden column.
If I start typing it changes the content of that hidden column. This is a bug. If the column is hidden, focus should never go on that column.
It causes all sorts of problems.

Thanks,
Pratima

Rajagopal [Syncfusion]
Replied On August 23, 2007 10:00 PM

Hi Pratima,

Thanks for your interest in Syncfusion Products.

By default, when the grid is loaded the currentcell will be set to the cell(1, 1). In your case, the current cell will be set to the hidden column when grid is loaded. Before the grid is displayed, you could determine the first visible column index in grid and move the currentcell to it. Below is some code snippets.

// move the currentcell to the first visiblecolumn in grid
int firstVisibleCol = GetFirstVisibleColIndex(this.gridDataBoundGrid1);
this.gridDataBoundGrid1.CurrentCell.MoveTo(1, firstVisibleCol);

private int GetFirstVisibleColIndex(GridDataBoundGrid grid)
{
int firstVisibleCol = -1;
for (int i = 1; i < grid.Model.ColCount; i++)
{
if (!grid.Model.HideCols[i])
{
firstVisibleCol = i;
break;
}
}
return firstVisibleCol;
}

Once you have set the currentcell to the visible column in grid, then you will not be able to focus the hidden column using arrowkeys/mouse, unless you explicitly call the Currentcell.MoveTo method to move the currentcell to the hidden column.

Please refer the below sample for more information on this regard.
http://websamples.syncfusion.com/samples/Grid.Windows/F67572/main.htm

Let me know if you have any other questions.

Have a nice time.
Regards,
Rajagopal


Pratima
Replied On August 24, 2007 06:01 PM

Thanks for your response and I already knew what to do to workaround this "defect".

I would have never posted this message if the problem was limited to only when the grid is displayed first time.

Problem is, Every time I click on the row header, focus goes back to the hidden cell.

I think it's ridiculous for clients of the grid to have to force the focus manually each time the row header is clicked.

If the columns are hidden GDBG should NOT be setting the focus on the cell of the hidden column in the first place.



>Hi Pratima,

Thanks for your interest in Syncfusion Products.

By default, when the grid is loaded the currentcell will be set to the cell(1, 1). In your case, the current cell will be set to the hidden column when grid is loaded. Before the grid is displayed, you could determine the first visible column index in grid and move the currentcell to it. Below is some code snippets.

// move the currentcell to the first visiblecolumn in grid
int firstVisibleCol = GetFirstVisibleColIndex(this.gridDataBoundGrid1);
this.gridDataBoundGrid1.CurrentCell.MoveTo(1, firstVisibleCol);

private int GetFirstVisibleColIndex(GridDataBoundGrid grid)
{
int firstVisibleCol = -1;
for (int i = 1; i < grid.Model.ColCount; i++)
{
if (!grid.Model.HideCols[i])
{
firstVisibleCol = i;
break;
}
}
return firstVisibleCol;
}

Once you have set the currentcell to the visible column in grid, then you will not be able to focus the hidden column using arrowkeys/mouse, unless you explicitly call the Currentcell.MoveTo method to move the currentcell to the hidden column.

Please refer the below sample for more information on this regard.
http://websamples.syncfusion.com/samples/Grid.Windows/F67572/main.htm

Let me know if you have any other questions.

Have a nice time.
Regards,
Rajagopal



Rajagopal [Syncfusion]
Replied On August 29, 2007 06:22 PM

Hi Pratima,

Thanks for your patience.

This issue seems to a defect. Please open a direc-trac incident mentioning this forum id in the incident details. We will consult with the development team on this and let you know the details in the the direc-trac incident.

Regards,
Rajagopal

Pratima
Replied On August 31, 2007 04:12 PM

Hi RajGopal,
As suggested, I have entered a Direct Track incident # 37043 .
Thanks,
Pratima

>Thanks for your response and I already knew what to do to workaround this "defect".

I would have never posted this message if the problem was limited to only when the grid is displayed first time.

Problem is, Every time I click on the row header, focus goes back to the hidden cell.

I think it's ridiculous for clients of the grid to have to force the focus manually each time the row header is clicked.

If the columns are hidden GDBG should NOT be setting the focus on the cell of the hidden column in the first place.



>Hi Pratima,

Thanks for your interest in Syncfusion Products.

By default, when the grid is loaded the currentcell will be set to the cell(1, 1). In your case, the current cell will be set to the hidden column when grid is loaded. Before the grid is displayed, you could determine the first visible column index in grid and move the currentcell to it. Below is some code snippets.

// move the currentcell to the first visiblecolumn in grid
int firstVisibleCol = GetFirstVisibleColIndex(this.gridDataBoundGrid1);
this.gridDataBoundGrid1.CurrentCell.MoveTo(1, firstVisibleCol);

private int GetFirstVisibleColIndex(GridDataBoundGrid grid)
{
int firstVisibleCol = -1;
for (int i = 1; i < grid.Model.ColCount; i++)
{
if (!grid.Model.HideCols[i])
{
firstVisibleCol = i;
break;
}
}
return firstVisibleCol;
}

Once you have set the currentcell to the visible column in grid, then you will not be able to focus the hidden column using arrowkeys/mouse, unless you explicitly call the Currentcell.MoveTo method to move the currentcell to the hidden column.

Please refer the below sample for more information on this regard.
http://websamples.syncfusion.com/samples/Grid.Windows/F67572/main.htm

Let me know if you have any other questions.

Have a nice time.
Regards,
Rajagopal




CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;