Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
datatables [2011/03/15 10:08]
wilco
datatables [2015/08/15 15:15] (current)
Line 117: Line 117:
             if (_tableParams.ContainsKey(DISPLAY_START))             if (_tableParams.ContainsKey(DISPLAY_START))
                 skip = (int)_tableParams[DISPLAY_START];​                 skip = (int)_tableParams[DISPLAY_START];​
-            if (_tableParams.ContainsKey(DISPLAY_START))+            if (_tableParams.ContainsKey(DISPLAY_LENGTH))
                 take = (int)_tableParams[DISPLAY_LENGTH];​                 take = (int)_tableParams[DISPLAY_LENGTH];​
  
Line 141: Line 141:
  
                 var paramExpr = Expression.Parameter(typeof(T),​ "​val"​);​                 var paramExpr = Expression.Parameter(typeof(T),​ "​val"​);​
-                var propertyExpr = Expression.Lambda<​Func<​T,​ object>>​(Expression.Property(paramExpr,​ _properties[sortcolumn]),​ paramExpr);+                var propertyExpr = Expression.Lambda<​Func<​T,​ object>>​(Expression.Convert(Expression.Property(paramExpr,​ _properties[sortcolumn]), typeof(object)), paramExpr); 
  
                 if (string.IsNullOrEmpty(sortdir) || sortdir.Equals(ASCENDING_SORT,​ StringComparison.OrdinalIgnoreCase))                 if (string.IsNullOrEmpty(sortdir) || sortdir.Equals(ASCENDING_SORT,​ StringComparison.OrdinalIgnoreCase))
Line 226: Line 227:
     }     }
 </​code>​ </​code>​
-This is the same as Zack Owen's code except it works with a dictionary object instead of the request object.+This is the same as Zack Owen's code except it works with a dictionary object instead of the request object. ​That's all there is to it!