Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
315
Sorting Issue
posted

Sorting Issue :

I created and POCO which Inclues another POCO via association and the grid blows.

Ex. Define Class - Address{ City , State, etc...}

Define ContactInfo{FirsName,LastName, Address, etc...} which contains User and Address

Bind the grid to a collection of contactinfo

 

<

 

 

ig:TextColumn Key="Address.City" HeaderText="Address" Width="201" />

 

 

 

 try to sort on Address Column which is a property of th Address class and the grid blows

 

 

 

  • 315
    posted

    Can you provide a TargetNullValue

  • 315
    posted

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    Below is the Class and Xaml for the xamGrid :

    I'm Using RiaServices the version of the control is 10.3.20103.1006

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    public class

    ContactInfo

    {

    [

     

     

    Key

    ]

     

     

     

    public long ContactID { get; set

    ; }

     

     

     

    public string FirstName { get; set

    ; }

     

     

     

    public string LastName { get; set

    ; }

     

     

     

    public string MI { get; set

    ; }

     

     

     

    public string SpouseFirstName { get; set

    ; }

     

     

     

    public string SpouseLastName { get; set

    ; }

     

     

     

    public string SpouseMI { get; set

    ; }

     

     

     

    public long UserID { get; set

    ; }

     

     

     

     

    //Holds Primary Address

    [

     

     

    Include

    ()]

    [

     

     

    Association("ContactInfo_AddressMappingInfo", "ContactID", "ContactID", IsForeignKey=true

    )]

     

     

     

    public AddressMappingInfo ContactAddressInfo { get; set

    ; }

     

     

     

    //Holds Primary Phone

    [

     

     

    Include

    ()]

    [

     

     

    Association("ContactPhoneInfo", "ContactID", "ContactID"

    )]

     

     

     

    public PhoneMappingInfo ContactPhoneInfo { get; set

    ; }

     

     

     

    //Holds Primary Email

    [

     

     

    Include

    ()]

    [

     

     

    Association("ContactEmailInfo", "ContactID", "ContactID"

    )]

     

     

     

    public EmailMappingInfo ContactEmailInfo { get; set

    ; }

     

     

     

    //Holds Primary Notes

    [

     

     

    Include

    ()]

    [

     

     

    Association("ContactNoteInfo", "ContactID", "ContactID"

    )]

     

     

     

    public ContactNotesInfo ContactNoteInfo { get; set

    ; }

     

    <

     

     

     

    ig:XamGrid x:Name="dgContacts" ItemsSource="{Binding Path=CurrentUserContacts}" AutoGenerateColumns="False" RowHover="Row" IsAlternateRowsEnabled="{Binding

    }">

     

     

     

     

    <ig:XamGrid.RowSelectorSettings

    >

     

     

     

     

    <ig:RowSelectorSettings EnableRowNumbering="True" Visibility

    ="Visible" />

     

     

     

     

    </ig:XamGrid.RowSelectorSettings

    >

     

     

     

     

    <ig:XamGrid.SelectionSettings

    >

     

     

     

     

    <ig:SelectionSettings CellSelection="None" RowSelection="Single" CellClickAction

    ="SelectRow" />

     

     

     

     

    </ig:XamGrid.SelectionSettings

    >

     

     

     

     

    <ig:XamGrid.Columns

    >

     

     

     

     

    <ig:TextColumn Key="FirstName" HeaderText="First Name" Width

    ="150" />

     

     

     

     

    <ig:TextColumn Key="LastName" HeaderText="Last Name" Width

    ="150"/>

     

     

     

     

    <ig:TextColumn Key="MI" HeaderText

    ="M.I" />

     

     

     

     

    <ig:TextColumn Key="ContactAddressInfo.Address" HeaderText="Address" Width

    ="201" />

     

     

     

     

    <ig:TextColumn Key="ContactAddressInfo.City" HeaderText="City" Width

    ="125"/>

     

     

     

     

    <ig:TextColumn Key="ContactAddressInfo.State" HeaderText

    ="State"/>

     

     

     

     

    <ig:TextColumn Key="ContactAddressInfo.ZipCode" HeaderText="Zip Code" Width

    ="75"/>

     

     

     

     

    </ig:XamGrid.Columns

    >

     

     

     

     

    </ig:XamGrid

    >

  • 21382
    posted

    I tried out your issue here but did not reproduce your results.  Below is the structure that I used for the XamGrid.

    Could you produce a simple sample showing this behavior?

    What version of the control are you using?

    And is the field you are comparing a string / int / double or another simple data type field or is it an object, from the look of it (a City field) i would assume it is a string, but if it is an custom object you would need to have defined IComparable on the object.

     

     

        <ig:XamGrid x:Name="grid" AutoGenerateColumns="false">

                <ig:XamGrid.Columns>

                    <ig:TextColumn Key="Address.Town"></ig:TextColumn>

                    <ig:TextColumn Key="Address.State"></ig:TextColumn>

                    <ig:TextColumn Key="Name"></ig:TextColumn>

                </ig:XamGrid.Columns>

            </ig:XamGrid>

     

     

            void MainPage_Loaded(object sender, RoutedEventArgs e)

            {

                List<Person> people = new List<Person>();

                for (int i = 0; i < 50; i++)

                {

                    Person p = new Person();

                    p.Name = "Person " + i;

                    Address a = new Address();

                    a.Town = "Town " + i;

     

                    if (i % 3 == 0)

                    {

                        a.State = "NJ";

                    }

                    if (i % 3 == 1)

                        a.State = "PA";

                    if (i % 3 == 2)

                        a.State = "DE";

                    p.Address = a;

                    people.Add(p);

                }

                grid.ItemsSource = people;

            }

        }

     

        public class Person

        {

            public string Name { get; set; }

            public Address Address { get; set; }

        }

        public class Address

        {

            public string State { get; set; }

            public string Town { get; set; }

        }