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. Image for the cookie policy date
close icon

Disable drill down in the grid

How to disable drill down in the Grid Grouping control?

I display in the grid collection of following objects

public class DataItem
{
public ICollection Attributes { get; private set; }
public string Name { get; private set; }
}

and I do not need display nested collection of Attributes in the grid. How to hide expander control [+] and prevent user drill down with keyboard?

5 Replies

RC Rajadurai C Syncfusion Team November 23, 2009 07:35 AM UTC

Hi Sergey,

Thanks for your interest in Syncfusion Products.

To prevent the nested table from getting shown by expanding the parent record, two things have to be followed in application.
1) ShowTableIndent property must be set to false.

this.gridGroupingControl1.TableOptions.ShowTableIndent = false;

2) RecordExpanding event have to handled to prevent the nested table droppingdown while expanding through keyboard.

this.gridGroupingControl1.RecordExpanding += new Syncfusion.Grouping.RecordEventHandler(gridGroupingControl1_RecordExpanding);

void gridGroupingControl1_RecordExpanding(object sender, Syncfusion.Grouping.RecordEventArgs e)
{
e.Cancel = true;
}

Here is a sample for your reference in which this has been implemented.
http://help.syncfusion.com/support/samples/Grid.Windows/7.4.0.20/F91503.zip

Regards,
Rajadurai


SM Sergey Merkuriev November 30, 2009 05:57 PM UTC

Thank you. That works. But I've got another problem with row selection. See attached picture.

Here is code which I use for row selection:

private void OnPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e)
{
Record record = this.GridControl.Table.CurrentRecord;
object dataItem = GetDataItem(record == null ? (object)null : record.GetData());

GridCurrentCell cc = this.GridControl.TableControl.CurrentCell;
GridControlBase grid = this.GridControl.TableControl.CurrentCell.Grid;

if (dataItem != null && e.Inner.RowIndex > grid.Model.Rows.HeaderCount &&
e.Inner.ColIndex > grid.Model.Cols.HeaderCount && cc.HasCurrentCellAt(e.Inner.RowIndex))
{
if (e.Inner.ColIndex == cc.ColIndex)
{
if (cc.IsEditing)
{
e.Inner.Style.Interior = new Syncfusion.Drawing.BrushInfo(SystemColors.Window);
}
else
{
e.Inner.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.RoyalBlue);
}
}
else
{
if (e.Inner.Style.Interior.BackColor == GridControl.BackColor)
{
e.Inner.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.CornflowerBlue);
}
else
{
int resultColor = AlphaBlendRGB(e.Inner.Style.Interior.BackColor.ToArgb(),
Color.CornflowerBlue.ToArgb(), 153);
e.Inner.Style.Interior = new Syncfusion.Drawing.BrushInfo(Color.FromArgb(resultColor));
}
}

e.Inner.Style.TextColor = cc.IsEditing ? SystemColors.WindowText : SystemColors.HighlightText;
e.Inner.Style.Font.Bold = cc.IsEditing ? false : true;
}
}

private static int AlphaBlendRGB(int src, int bg, byte alpha)
{
uint rb = (uint)((((src & 0x00ff00ff) * alpha) + ((bg & 0x00ff00ff) * (0xff - alpha))) & 0xff00ff00);
uint g = (uint)((((src & 0x0000ff00) * alpha) + ((bg & 0x0000ff00) * (0xff - alpha))) & 0x00ff0000);
return (int)((src & 0xff000000) | ((rb | g) >> 8) + 0x00010101);
}



Selector_ca1b5695.rar


SM Sergey Merkuriev November 30, 2009 07:23 PM UTC

I forgot to say:

1. That problem, I mentioned before, happen only with records which has option to drill down.
2. Rows/record selection I have made according to example "Focused Selection" from "Syncfusion\EssentialStudio\6.4.0.15\Windows\Grid.Grouping.Windows\Samples\2.0\Selections\MultipleRecordSelection\"
If you will bound to that example collection of objects like I mentioned first post then you will get same problem.


SM Sergey Merkuriev November 30, 2009 07:57 PM UTC

Problem solved with using condition "e.Inner.Style.CellType != "Static""

Example:

if (dataItem != null && e.Inner.RowIndex > grid.Model.Rows.HeaderCount &&
e.Inner.Style.CellType != "Static" &&
e.Inner.ColIndex > grid.Model.Cols.HeaderCount && cc.HasCurrentCellAt(e.Inner.RowIndex))


I think you need update your examples too.


JJ Jisha Joy Syncfusion Team December 1, 2009 06:36 AM UTC

Hi Sergey,

Thank you for your update. Glad to hear that issue has been resolved.

Regards,
Jisha

Loader.
Live Chat Icon For mobile
Up arrow icon