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

Strange selection problem when data from a VirtualQueryableCollectionView loads in my grid

4 Answers 103 Views
Data Virtualization
This is a migrated thread and some comments may be shown as answers.
Jonx
Top achievements
Rank 2
Jonx asked on 03 Feb 2011, 11:34 PM

Hello,

I'm using WCF RIA Services 1.0 not the SP1 and latest silverlight libs...

I used the code from the Data Virtualization first look demo...

Straight cut&paste.

My grid looks like that:

            <telerik:RadGridView Grid.Row="1" Name="grdHistory" Margin="0,5" IsReadOnly="True" AutoGenerateColumns="False" ShowInsertRow="False"
                                 ItemsSource="{Binding HistoryOrderLines}" ShowGroupFooters="True" ShowColumnFooters="True"
                                 Exporting="grdHistory_Exporting" CanUserInsertRows="False" CanUserDeleteRows="False"
                 ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Visible" >
                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn Header="AnnĂ©e" DataMemberBinding="{Binding PeriodeAnnee}" UniqueName="PeriodeAnnee" />
                    <telerik:GridViewDataColumn Header="Mois" DataMemberBinding="{Binding PeriodeMois}" UniqueName="PeriodeMois" />
                    <telerik:GridViewDataColumn Header="Code Client" DataMemberBinding="{Binding CodeClient}" UniqueName="CodeClient" />
                    <telerik:GridViewDataColumn Header="Distribution" DataMemberBinding="{Binding Distribution}" UniqueName="Distribution" />
                    <telerik:GridViewDataColumn Header="Matricule" DataMemberBinding="{Binding Matricule}" UniqueName="Matricule" />
                    <telerik:GridViewDataColumn Header="Badge" DataMemberBinding="{Binding Badge}" UniqueName="Badge">
etc...

Nothing special.

Now when I load my data, the first lines come already selected. See my screenshot.

The only thing I see is that I use composition. Here is my query:

public IQueryable<CustomerPresentationModel> GetBeneficiaryOrderLinesHisto()  
        {
            var ctx = this.ObjectContext;
    
            var customers = from o in ctx.OrderLines // where o.CreatedOn >= begin && o.CreatedOn <= end
                            join b in ctx.Beneficiaries.Include("FacialValue") on o.BenID equals b.BenID
                            join c in ctx.Commands on o.CmdID equals c.CmdID where c.IsHistory == true
                            select new CustomerPresentationModel()
                            {
                                PeriodeMois = c.PeriodeMois,
                                PeriodeAnnee = c.PeriodeAnnee,
                                Abscence = o.Abscence,
                                //Anomalie, empty message storage
                                Badge = b.Badge,
                                BenID = b.BenID,
                                Civ = b.Civ,
                                CodeClient = b.CodeClient,
etc...
                            };
            return customers.OrderBy(e => e.CodeClient).ThenBy(e => e.Distribution).ThenBy(e => e.Nom);
        }
My object definition:
public partial class CustomerPresentationModel
    {
        public int Abscence { get; set; }
  
        public string Badge { get; set; }
  
        [Key]
        public int BenID { get; set; }
  
        public string Civ { get; set; }
  
        public Nullable<DateTime> CreatedOn { get; set; }
  
        public int CmdID { get; set; }

        public int OdlID { get; set; }
  
        public string PeriodeMois { get; set; }
  
        public string PeriodeAnnee { get; set; }
  
        public string Personalisation { get; set; }
etc...    }
Nothing fancy...
Any help would be much appreciated...
Thanks a lot in advance,
John.

4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 04 Feb 2011, 07:34 AM
Hi,

You've missed to attach the screenshot - can you attach it again? 

Best wishes,
Vlad
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Jonx
Top achievements
Rank 2
answered on 04 Feb 2011, 08:14 AM
Yeah, sorry about that... Here it is, and know that the selection is hard to unselect, the only way is to click CTRL+clic on each line. One by one...
0
Accepted
Vlad
Telerik team
answered on 04 Feb 2011, 08:59 AM
Hi,

 It looks like these data items are actually single instance and the grid gets confused which is current (and selected). Can you send us an example where we can reproduce this? 

Kind regards,
Vlad
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Jonx
Top achievements
Rank 2
answered on 06 Feb 2011, 09:12 PM

Ha cool! That was my problem indeed.

The ID I was using was not unique...

I changed it for another unique id and this time it is working correctly.

Thanks a lot Vlad. 

ps: to reproduce the problem, just use a non unique ID and all rows with that ID will get selected at loading (I guess it's because the first line in the grid gets sellected by default, and the draw routine will draw as selected all the rows with that ID). Now, can this be described as a bug. I don't know. I guess that having non unique id's can lead to other problems...

Tags
Data Virtualization
Asked by
Jonx
Top achievements
Rank 2
Answers by
Vlad
Telerik team
Jonx
Top achievements
Rank 2
Share this question
or