The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

Can't sort by calculated columns

Last post 11-24-2007, 5:42 AM by Mike.Griffin. 1 replies.
Sort Posts: Previous Next
  •  11-23-2007, 9:03 PM 6805

    Can't sort by calculated columns

    Following the blog example for adding a FakeColumn, I added a calculated column.  I then bind a collection of that data to the DataGridView control.  It works great, except that it won't sort when I click on the columns that are calculated.  By "won't sort", I mean that clicking on the column header does not change the order of the rows.

     Any thoughts on what I should look at?
     

     Thanks,

    Dan

    Code:
    GradestableCollection gradeCollection = new GradestableCollection();
    gradeCollection.QueryReset();
    gradeCollection.LoadAll();
    
    ResultsDataGridView.DataSource = gradeCollection;  // this works, but it doesn't sort on the two calculated columns
    
    
    // now, an excerpt from Gradestable.cs
    // the two columns, referralSpeed and referralRecommendation are calculated from other columns (but not in a way that could reasonably be done with SQL in a SELECT statement.)
    
    namespace BusinessObjects
    {
    	public partial class Gradestable : esGradestable
    	{
    		public int referralSpeed
    		{
    			get { return CalculateReferralSpeed(); }
    			set {  }
    		}
    
    		public string referralRecommendation
    		{
    			get { return CalculateReferralRecommendation(); }
    			set {  }
    		}
    		
    		protected override List GetLocalBindingProperties()
    		{
    			List props = new List();
    
    			props.Add(new esPropertyDescriptor(this, "referralSpeed", typeof(int)));
    			props.Add(new esPropertyDescriptor(this, "referralRecommendation", typeof(string)));
    			return props;
    		}


     
  •  11-24-2007, 5:42 AM 6806 in reply to 6805

    Re: Can't sort by calculated columns

    Currently, EntitySpaces will only sort based on columns in the actual underlying DataTable. However, certain grids such as DevX sort the data externally themselves (I noticed even my fake virtual columns sorted in DevX).  I'll reply later with a possible work around, just need to test something out first.

    EntitySpaces | Twitter | BLOG | Please honor our Software License
View as RSS news feed in XML