This is a migrated thread and some comments may be shown as answers.

Nested Grid '+' sign enable/disable if no child records exits.

11 Answers 859 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Lee
Top achievements
Rank 1
Lee asked on 20 Mar 2010, 06:56 PM
Hi
In Nested Grid, we get a '+' sign.   The problem is that '+' sign appears all times, even if there are no child records for that row.

1. Can we enable/disable OR Hide/Unhide '+' sign. depending on if child rows exits.

2. OR alteast we can put some bgcolor indicating to user that this record do have child rows.

Without any indicator user may feel quite annoying to click on '+' sign and nothing happens.

Regards
lee.

11 Answers, 1 is accepted

Sort by
0
Accepted
Jack
Telerik team
answered on 23 Mar 2010, 03:01 PM
Hi Lee,

Please take a look at the following knowledge base article: Hide expand/collapse image in hierarchical RadGridView. It demonstrates how to hide the '+' sign for rows that have no children. I hope it helps.
All the best,
Jack
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Lee
Top achievements
Rank 1
answered on 23 Mar 2010, 05:16 PM
Thanks.

Done. It works.
0
Mike
Top achievements
Rank 1
answered on 21 Jul 2010, 06:54 AM
Hi Jack,

I tried this option in my code. It is not working. I get an error in "cell.Expander". Intellisense does not have the Expander option at all.

I'm using Telerik Rad Controls version 2010.1.10.504

Kindly let me know if the following code has any changes for the control version I'm using

Kindly suggest.

Thanks
 
GridGroupExpanderCellElement cell = e.CellElement as GridGroupExpanderCellElement;
                if (cell != null && e.CellElement.RowElement is GridDataRowElement)
                {
                    if (!IsExpandable(cell.RowInfo))
                    {
                        cell.Expander.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
                    }
                    else
                    {
                        cell.Expander.Visibility = Telerik.WinControls.ElementVisibility.Visible;
                    }
                }
0
Alexander
Telerik team
answered on 26 Jul 2010, 03:05 PM
Hello Mike,

Thank you for your question.

The KB articles are up-to-date with the last version of the controls - Q2 2010. This version of RadGridView introduces the Expander element which gives the GridGroupExpanderCellElement more flexible styling capabilities.

For Q1 2010 (v2010.1.10.504) version of RadGridView you can use:

private void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
    GridGroupExpanderCellElement cell = e.CellElement as GridGroupExpanderCellElement;
    if (cell != null && e.CellElement.RowElement is GridDataRowElement)
    {
        bool isExpandable = IsExpandable(cell.RowInfo);
 
        cell.DrawSignBorder = isExpandable;
        cell.DrawSignFill = isExpandable;
        if (!isExpandable)
        {
            cell.SignImage = null;
            cell.SignStyle = GridGroupExpanderCellElement.SignStyles.Image;
        }
        else
        {
            cell.SignStyle = GridGroupExpanderCellElement.SignStyles.PlusMinus;
        }
    }
}

I hope it helps.

Best regards,
Alexander
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Richard Slade
Top achievements
Rank 2
answered on 26 Aug 2010, 03:24 PM
Hi, 

I'm trying to do the same thing, and I'm also using 2010 Q1. However, I'm having issues with the IsExpandable method. RowInfo does not have a ChildRows property. Can you advise how I should re-code the isExpandable method please for the 2010 Q1 release? 
Thanks
Richard
0
Alexander
Telerik team
answered on 30 Aug 2010, 09:59 PM
Hello Richard Slade,

Thank you for your question.

For Q1 2010 and previous versions the IsExpandable method works as follows:

private bool IsExpandable(GridViewRowInfo rowInfo)
{
    foreach (GridViewTemplate template in rowInfo.ViewTemplate.ChildGridViewTemplates)
    {
        GridViewRowInfo[] rows = template.GetChildRows(rowInfo);
        if (rows != null && rows.Length > 0)
        {
            return true;
        }
    }
 
    return false;
}

I hope it helps.

Regards,
Alexander
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Richard Slade
Top achievements
Rank 2
answered on 31 Aug 2010, 09:55 AM
Thanks Alexander
0
Felipe
Top achievements
Rank 1
answered on 16 Sep 2010, 07:22 AM
Is there a way to hide the complete column?

Becuase I expand the child when you select the parent row so I want to hide the comple column not only the image.



0
Richard Slade
Top achievements
Rank 2
answered on 16 Sep 2010, 09:31 AM
Not quite sure what you mean there. If you get rid of the column you wont be able to see any of the +- symbols
0
Felipe
Top achievements
Rank 1
answered on 16 Sep 2010, 04:42 PM

That's exactly what.  I want hide the column so the user can not see +/- or and empty small column cause I was able to hide the symbols but no the column.

I implemented a method to show the child rows when you do a click in any cell of the parent row.

That way is easer for the user, cause they dont have to go to specific small image to expand and unexpand the child rows.

=( I have posted 4 question in the forums never get the correct answer.

thanks,

Felipe
0
Alexander
Telerik team
answered on 21 Sep 2010, 03:51 PM
Hello Felipe,

Please review the Jack's answer in this forum thread.

Best regards,
Alexander
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Lee
Top achievements
Rank 1
Answers by
Jack
Telerik team
Lee
Top achievements
Rank 1
Mike
Top achievements
Rank 1
Alexander
Telerik team
Richard Slade
Top achievements
Rank 2
Felipe
Top achievements
Rank 1
Share this question
or