I'm using Umbraco 4.0.3, and on the website I am using the Ultimate Picker to list a big checkbox list of about 250 odd items. The issue is that these are not in alphabetical order - so it's a nightmare for the client to find which ones need to be checked. To be clear, I'm talking about the client UI side of things, that a client will use when actually using the picker.
I'm digging around the source, there is an 'addListControlNode' method, which takes an 'umbraco.cms.businesslogic.Content' paramater and iterates through the Children property and add items to the CheckboxList control. I have no idea if it's possible to sort this type of object.
So I'm thinking I have two options. I can loop through the Children property, and build up my own list of the elements and then sort them with an applicable algorithm (sounds messy). OR I can use XPath pieces and the methods in the umbraco.library namespace (GetXmlNodeByID..etc).. and sort then using XPath. This second option would require a fair bit more of a code change and I'm trying to get this out the door ASAP.
Extending the Umbraco Ultimate Picker to Sort
Hi Guys,
I'm using Umbraco 4.0.3, and on the website I am using the Ultimate Picker to list a big checkbox list of about 250 odd items. The issue is that these are not in alphabetical order - so it's a nightmare for the client to find which ones need to be checked. To be clear, I'm talking about the client UI side of things, that a client will use when actually using the picker.
I'm digging around the source, there is an 'addListControlNode' method, which takes an 'umbraco.cms.businesslogic.Content' paramater and iterates through the Children property and add items to the CheckboxList control. I have no idea if it's possible to sort this type of object.
So I'm thinking I have two options. I can loop through the Children property, and build up my own list of the elements and then sort them with an applicable algorithm (sounds messy). OR I can use XPath pieces and the methods in the umbraco.library namespace (GetXmlNodeByID..etc).. and sort then using XPath. This second option would require a fair bit more of a code change and I'm trying to get this out the door ASAP.
Any thoughts or insights?
.. Wait.. I'm a noob... linq to the rescue..
Hrm, not quite perfect though, because the parent node I am using contains sub nodes, and it's sorting each of the subnodes independently....
So now, after all the items have been added to the ListItem collection, I am just sorting that using a handy little extension method.
is working on a reply...