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

Edit & SelectedItem

10 Answers 178 Views
GridView
This is a migrated thread and some comments may be shown as answers.
MiddleTommy
Top achievements
Rank 1
MiddleTommy asked on 02 Dec 2009, 10:13 PM
When you have EditTriggers="CellClick, Default, F2" on a RadGridView the SelectedItem does not change when you click to edit another row unless you click on a read only row
See the attached picture to see what I mean

10 Answers, 1 is accepted

Sort by
0
Accepted
Milan
Telerik team
answered on 03 Dec 2009, 02:45 PM
Hi TWT,

Though it is a bit strange but this is the expected behavior at the moment. So achieve the desired behavior you can subscribe to the BeginningEdit event and select the row that is being edited.

private void playersGrid_BeginningEdit(object sender, GridViewBeginningEditRoutedEventArgs e)
{
    e.Row.IsSelected = true;
}


Best wishes,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
MiddleTommy
Top achievements
Rank 1
answered on 03 Dec 2009, 03:15 PM
Thanks for the answer.
While we are on the subject I noticed that clicking on the row selector column does not select the row?

0
Vlad
Telerik team
answered on 03 Dec 2009, 03:31 PM
Hi TWT,

This is already fixed and you can try our latest build.

Regards,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
MiddleTommy
Top achievements
Rank 1
answered on 04 Dec 2009, 02:18 PM
I have the latest build and the RowSelectorColumn works except when you have a scenario like in the above picture.
If you click the Selector Column on the Editing Row it will not change the Selected Row to the Current Editing Row
0
Milan
Telerik team
answered on 10 Dec 2009, 09:07 AM
Hello TWT,

 As far as I can understand you would like to be able to enter edit mode when the indicator cell is clicked. If I have understood you correctly you should do something like that:

public Window1()
{
    InitializeComponent();
  
    this.playersGrid.ItemsSource = Club.GetPlayers();
    this.playersGrid.SelectionChanged += new System.EventHandler<SelectionChangeEventArgs>(playersGrid_SelectionChanged);
}
  
void playersGrid_SelectionChanged(object sender, SelectionChangeEventArgs e)
{
    if (e.AddedItems.Count < 1)
        return;
  
    var row = this.playersGrid.ItemContainerGenerator.ContainerFromItem(e.AddedItems[0]) as GridViewRow;
  
    this.Dispatcher.BeginInvoke(new Action(() => this.BeginEditIfNeeded(row)));
}
  
private void BeginEditIfNeeded(GridViewRow row)
{
    if (row != null && !row.IsInEditMode)
        row.BeginEdit();
}


Greetings,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
MiddleTommy
Top achievements
Rank 1
answered on 10 Dec 2009, 08:50 PM
No,
What I wanted it to do is change the selected row when I click on the selector cell. If the Row is not selected but is being edited you can not select that row.
0
Milan
Telerik team
answered on 16 Dec 2009, 06:14 PM

Hello TWT,

Currently there is a problem with this approach. We will investigate it and I will post more information.

If you follow the proposed approach with setting IsSelected when the BeginningEdit event is fired you should be able to workaround this issue.


Regards,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Milan
Telerik team
answered on 17 Dec 2009, 04:06 PM

Hello TWT,

We have investigated the issue and we could possibly allow users to select the current row by clicking on an indicator cell but that action will commit the currently pending edit. Could you share your thoughts on this behavior?


Regards,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
MiddleTommy
Top achievements
Rank 1
answered on 17 Dec 2009, 05:41 PM
Yes the work around is what I am going to use to solve the issue for me. In my opinion that should be the default behavior.But I am used to using other grids and am fairly new to Telerik.
As for the End Editing of the Cell when the row becomes selected; It makes logical sense because the cell would stop being edited if you clicked anywhere else.
In my program I have lots of situations where you click a button to perform actions on the Selected Row(s). I just found it very frustrating to either not be able to easily edit a row or not be able to easily select the row(s)
0
Milan
Telerik team
answered on 18 Dec 2009, 02:23 PM
Hi TWT,

We have made the modification that I have mentioned - now when an indicator cell is clicked the respective row will be selected. The improvement will be available with our next internal build.

Thank you for your feedback. I have updated your Telerik points.


Kind regards,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
MiddleTommy
Top achievements
Rank 1
Answers by
Milan
Telerik team
MiddleTommy
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or