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

5 posts, 1 answers
  1. Jonx
    Jonx avatar
    258 posts
    Member since:
    Jul 2012

    Posted 03 Feb 2011 Link to this post

    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.

  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 04 Feb 2011 Link to this post

    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>>
  3. DevCraft banner
  4. Jonx
    Jonx avatar
    258 posts
    Member since:
    Jul 2012

    Posted 04 Feb 2011 Link to this post

    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...
  5. Answer
    Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 04 Feb 2011 Link to this post

    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>>
  6. Jonx
    Jonx avatar
    258 posts
    Member since:
    Jul 2012

    Posted 06 Feb 2011 Link to this post

    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...

Back to Top
DevCraft banner