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

[Solved] Blank grid after rows deleted

15 Answers 182 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Robert Smyth
Top achievements
Rank 1
Robert Smyth asked on 20 Oct 2010, 06:01 AM
Hi,

I'm using RadGridView in an application were user selections on the page change the number of rows in the grid. When viewing the last 30 rows in a grid of 100 rows and the last 60 rows are removed from the grid we see a blank grid with the now last row visible at the bottom. If we click on a column header it refreshes and all rows are visible. The scroll bar is correctly indicating 30 rows.

How can I remove rows and have the grid display the remaining rows?

The grid XAML is:
<Controls:RadGridView Name="myTable"
                             Grid.Row="0" Width="Auto" Height="Auto" MinHeight="150"
                             GroupPanelBackground="LightGray"
                             GroupPanelForeground="LightGray"
                             VerticalGridLinesBrush="Transparent"
                             HeaderRowStyle="{StaticResource HeaderRowStyle}"
                             GridLinesVisibility="None"
                             RowIndicatorVisibility="Collapsed"
                             DataLoadMode="Asynchronous"
                             EnableRowVirtualization="True"
                             EnableColumnVirtualization="True"
                             AlternationCount="2"
                             SelectionMode="Extended"
                             AutoGenerateColumns="False"
                             ItemsSource="{Binding Mode=OneWay,Path=MyData}"
                             IsReadOnly="True"
                             CanUserResizeColumns="True"
                             IsFilteringAllowed="False"
                             CanUserSortColumns="True"
                             AllowDrop="False"
                             ShowGroupPanel="False"
                             ShowInsertRow="False"
                             VerticalAlignment="Top"
                             DataLoaded="MyTableDataLoaded"
                             ColumnWidth="Auto" 
                             CanUserInsertRows="False"
                             CanUserDeleteRows="False"
                    CanUserFreezeColumns="False"
                             CanUserReorderColumns="False"
                    SelectionChanged="MyTableSelectionChanged">
            
           <Controls:RadGridView.Columns>
 
               <Controls:GridViewDataColumn HeaderCellStyle="{StaticResource HeaderCellStyle}" Header="Date" DataMemberBinding="{Binding Path=TimeStamp,StringFormat=dd/MM}"/>
               <Controls:GridViewImageColumn HeaderCellStyle="{StaticResource HeaderCellStyle}" Header="AAA" DataMemberBinding="{Binding AAA,Converter={StaticResource AAAToImageConverter}}" ImageHeight="12" />
               <Controls:GridViewDataColumn HeaderCellStyle="{StaticResource HeaderCellStyle}" Header="BBB" DataMemberBinding="{Binding BBB,StringFormat=N0}" TextAlignment="Right"/>
               <Controls:GridViewDataColumn HeaderCellStyle="{StaticResource HeaderCellStyle}" Header="CCC" DataMemberBinding="{Binding CCC,StringFormat=N0}"  TextAlignment="Right"/>
                
           </Controls:RadGridView.Columns>
       </Controls:RadGridView>

In the data loaded handler we do call 'ScrollIntoView' to ensure that the last row is visible.

Any ideas?

Rob Smyth

15 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 25 Oct 2010, 08:44 AM
Hi,

 Can you post more info about the grid version? I remember we had such issues in the past however these were fixed. Are you using our latest version (Q2 2010 SP2)? 

Regards,
Vlad
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
Robert Smyth
Top achievements
Rank 1
answered on 28 Oct 2010, 12:04 AM
Hi,

Yes I'm using the Q2 2010 release. The grid view assembly version is 2010.2.812.1040.

Thx

Rob Smyth
0
Yordanka
Telerik team
answered on 28 Oct 2010, 02:08 PM
Hi Robert Smyth,

Can you try our Q2 2010 SP2 (version .0924) ? If this behavior can be reproduced with this version please specify how the items are removed from the grid ?

Greetings,
Yordanka
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
Robert Smyth
Top achievements
Rank 1
answered on 29 Oct 2010, 03:17 AM
Hi,

Happy to but I'm having difficulty finding the download page ... can you give me a url to download from?

Thx

Rob
0
Yordanka
Telerik team
answered on 29 Oct 2010, 05:54 AM
Hi Robert Smyth,

You can download it from Your account -> Downloads -> Free Trials -> RadControl for Silverlight or follow this link.

Greetings,
Yordanka
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
Robert Smyth
Top achievements
Rank 1
answered on 05 Nov 2010, 12:07 AM
Hi,

Thx, sorry but I cannot see the download (Q2 SP2) on my account page. I see others but not that one. So I'm still unable to find the download to try. Can you give me a direct link to it?

Rob

0
Robert Smyth
Top achievements
Rank 1
answered on 05 Nov 2010, 05:05 AM
Hi,

Found the download. Problem persists with the version suggested.

Rob Smyth
0
Yordanka
Telerik team
answered on 09 Nov 2010, 12:28 PM
Hello Robert Smyth,

We were able to reproduce the problem and it was fixed immediately. The fix will be part of our Q3 2010 release which will be out later this week. 

Thank you for reporting this. I have updated your Telerik points.
 
Kind regards,
Yordanka
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
Robert Smyth
Top achievements
Rank 1
answered on 11 Nov 2010, 12:08 AM
Hi,

Sorry, I've installed the Q3 release this morning and still have the problem. After deleting rows the gridview resizes to the correct number of rows but only displays the last (bottom) row. The rest are blank.

I've checked we are using GridView dll 2010.3.1110.1040.

Rob
0
Robert Smyth
Top achievements
Rank 1
answered on 11 Nov 2010, 04:00 AM
Hi,

Futher info .... I have found that the problem only happens if EnableRowVirtualization is set to True.

Rob Smyth
0
Yordanka
Telerik team
answered on 12 Nov 2010, 08:53 AM
Hello Robert Smyth,

I am attaching my sample project where the problem cannot be reproduced with Q3 2010 assemblies. Please, feel free to modify it in order to demonstrate it.
 
Best wishes,
Yordanka
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
Nathaniel
Top achievements
Rank 1
answered on 12 May 2011, 06:07 PM

I am using the May 2nd internal release .dlls.

I am seeing a problem similar to what was described above.  I have a grid with a vertical scrollbar. 
If I
select an item in the middle of the grid
scroll to the bottom so the selected item is out of view
and select the last item in the grid while holding shift, so I select all the items in between.

Then I hit a delete button and the grid does not update properly, it appears blank until I click on the column headers to update the sorting.

Here are the changes in made to your attached project above(RadGridView_SL4_AR_16).

I changed the Delete button click logic.

private void Button1_Click(object sender, RoutedEventArgs e)

        {           

            IEnumerable<DataItem> dataEnumerable = (IEnumerable<DataItem>)this.myTable.ItemsSource;

            List<DataItem> dataList = dataEnumerable.ToList();

            foreach (DataItem curData in this.myTable.SelectedItems ) {

                dataList.Remove(curData);

            }

           this.myTable.ItemsSource = dataList;

        }

        private void MyTableDataLoaded(object sender, EventArgs e)

        {

           

          // this.myTable.ScrollIntoView(this.myTable.Items[this.myTable.Items.Count - 1]);

           

        }

And I commented out the DataLoadMode, and set EnableColumnVirtualization="False"

<telerik:RadGridView Name="myTable" Grid.Row="0" Width="Auto" Height="Auto" MinHeight="150"

                             GroupPanelBackground="LightGray"

                             GroupPanelForeground="LightGray"

                             VerticalGridLinesBrush="Transparent"                           

                             GridLinesVisibility="None"

                             RowIndicatorVisibility="Collapsed"

                           

                             EnableRowVirtualization="True"

                             EnableColumnVirtualization="False"

                             AlternationCount="2"

                             SelectionMode="Extended"

                             AutoGenerateColumns="False"

                             ItemsSource="{Binding Mode=OneWay,Path=MyData}"

                             IsReadOnly="True"

                             CanUserResizeColumns="True"

                             IsFilteringAllowed="False"

                             CanUserSortColumns="True"

                             AllowDrop="False"

                             ShowGroupPanel="False"

                             ShowInsertRow="False"

                             VerticalAlignment="Top"

                             DataLoaded="MyTableDataLoaded"

                             ColumnWidth="Auto"

                             CanUserInsertRows="False"

                             CanUserDeleteRows="False"

                             CanUserFreezeColumns="False"

                             CanUserReorderColumns="False"

                             SelectionChanged="MyTableSelectionChanged">

           

            <!--DataLoadMode="Asynchronous"-->

0
Yordanka
Telerik team
answered on 16 May 2011, 11:58 AM
Hello,

The best approach to delete items on button click is by using Delete command as demonstrated on this example:

<telerik:RadButton Name="Button1"
                Content="Delete"
                Command="telerik:RadGridViewCommands.Delete"
                CommandTarget="{Binding ElementName=myTable}"
                Margin="5"
                HorizontalAlignment="Left"/>

Let us know in case this approach is not acceptable for you or your requirements are different.
 
Best wishes,
Yordanka
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
Andrew
Top achievements
Rank 1
answered on 21 Jul 2011, 07:35 PM
I am using Telerik.Windows.Controls.GridView.dll version 2011.1.419.35 and I am also seeing this problem.

I am able to reproduce it easily with these steps:
1) Scroll to the bottom of a large list of items
2) Delete X (where X >= 2) items from the item collection that the RadGridView's ItemSource is bound to. This results in X-1 blank rows at the top of the RadGridView window
3) Clicking on the RadGridView or scrolling will cause it to update and correct the problem.

I have also verified that this only happens when I have EnableRowVirtualization set to True.
0
Vlad
Telerik team
answered on 22 Jul 2011, 07:40 AM
Hello Andrew,

 I've just replied to your support ticked!

The problem is already fixed in our latest official version - Q2 2011.

All the best,
Vlad
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
GridView
Asked by
Robert Smyth
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Robert Smyth
Top achievements
Rank 1
Yordanka
Telerik team
Nathaniel
Top achievements
Rank 1
Andrew
Top achievements
Rank 1
Share this question
or