Better sorting of Pages plus datatypes

Topics: Feature requests, General
Sep 21, 2011 at 4:59 PM

For people wanting to try out new stuff, i created a package for enabling sorting of data types, plus drag and drop sorting of pages.

Known issues

  • Sorting doesn't trigger a refresh of the tree
  • Filtering/grouping of global data isn't reflected on the sorting page.

How to use

Pages 

  • Is automatically enabled. Right click on a page and see the new Sort option, that lists all child pages where you can drag and drop

Dynamic datatypes 

  • Right click on the Data type definition and see there is new option called "Enable sorting". When you click this the Type Descriptor is altered and the interface IGenericSortable is added to its SuperInterfaces 
  • A new field LocalOrdering is added to the type, which you can use for sorting in the TreeDefinition file, Function Call editor or Code Behind LINQ statements 
  • Right click on a data instance or a datafolder and see the option "Sort" which opens a page with all the data instances that you can drag and drop. 
  • Right click on the Data type definiton and choose "Disable sorting" to remove the interface and the field again

Static datatypes 

  • Just implement the CompositeC1Contrib.Sorting.IGenericSortable interface and the same console options will appear as described above.

Download the package from here http://compositec1contrib.codeplex.com/SourceControl/list/changesets and unzip. In C1 Console go to install local packages, and browse for Sorting/Package/package.zip

Sep 29, 2011 at 4:43 PM

In the newest version i just uploaded (1.2.0), drag and dropping page elements will automatically refresh the tree after each drop. It should also work for all datatypes, but when using GroupBy in TreeDefinition it seems to break. A manual refresh by right-clicking the folder at choosing "refresh" does the trick though.

Apr 23, 2013 at 2:40 PM
Somehow i forgot to commit and push a change i made to the Sorting package long time ago. In short, its possible to filter the instances of a given type when you want to sort. Its not super optimized since it happens in-memory using reflection, maybe someone wants to push a optimization which uses Expression Trees? :)

Usage is quite simple when using with CustomUrl's when making Tree Definitions, just pass something like ?type=DIP.Data.Types.IEmployee&filter=IDepartmentId%3Debe6cbe5-c2c4-49a7-bde7-b6ea1d2cfec1

https://bitbucket.org/burningice/compositec1contrib/commits/be940f65fd3d421ba506156cefa6b0590a59c2eb
Jun 14, 2013 at 7:20 PM
Thanks for this! Just installed it and so far it works great -- really nice addition!
Jun 25, 2013 at 12:06 PM
This is great! I found a bug:

If one of the sub-page names contains an ampersand (&), you get a big fat:

error on line 135 at column 33: xmlParseEntityRef: no name
Jun 25, 2013 at 12:09 PM
I wonder whether there could be a better icon than re-using the scissors icon?
Jun 25, 2013 at 1:25 PM
Fixed the issue with the & (and possible a bunch of other illegal characters) by HtmlEncoding the label. Also added the TreeOrdering attribute to LocalOrdering so C1 trees now will sort by this property.

https://bitbucket.org/burningice/compositec1contrib/commits/7cda34b850f454ea4ef312e3cec067d7ab3336ab
May 2, 2014 at 12:57 PM
Is there a way to use this via a tree definition by attaching an action? I think there might be via a CustomUrlAction but not entirely sure how to set it up.

Thanks.
May 2, 2014 at 3:46 PM
Yeah. The easiest is to sort all instances of a datatype like this

<CustomUrlAction Label="Sort" Url="~/Composite/InstalledPackages/CompositeC1Contrib.Sorting/Sort.aspx?type=your_type_name" />

if you only need to sort a subset of the data you can attach a filter like this

<CustomUrlAction Label="Sort" Url="~/Composite/InstalledPackages/CompositeC1Contrib.Sorting/Sort.aspx?type=your_type_name&filter=<Property_On_You_type>%3D<A_Value>" />