Ted,

I'm afraid that's not possible at the moment, unless you're willing to 
override a sizable chunk of code in Exhibit, as below.

The code in question is in
    
http://static.simile.mit.edu/exhibit/api-2.1.0/scripts/ui/views/ordered-view-frame.js
Search for
    Exhibit.OrderedViewFrame.prototype._internalReconstruct
Within that function, search for
    var processNonNumericLevel = function(items, index, values, valueType) {
        ...
        if (valueType == "item") {
            ...
        } else { // text
            ...
        }

You want another case
    var processNonNumericLevel = function(items, index, values, valueType) {
        ...
        if (valueType == "item") {
            ...
        } else if (order.property == "type" && order.forward) {
            var map = {
               "US Legal Databases" : 0,
               "Foreign Law Databases" : 1,
               ... add everything here ...
            };

            values.visit(function(typeID) {
                keys.push({ display: typeID, index: typeID in map ? 
map[typeID] : -1 });
            });
           
            compareKeys = function(key1, key2) {
                var c = key1.index - key2.index;
                return c != 0 ? c : 
key1.display.localeCompare(key2.display);
            };
            retrieveItems = function(key) {
                return database.getSubjects(key.display, "type", null, 
items);
            };
        } else { // text
            ...
        }

So you would need to copy the whole 
Exhibit.OrderedViewFrame.prototype._internalReconstruct function and add 
it after including exhibit-api.js, with the changes shown above:

    <script src=" .... /exhibit-api.js"></script>
    <script>
       Exhibit.OrderedViewFrame.prototype._internalReconstruct = 
function() {
          ... copied and pasted code, with changes ...
       };
    </script>

David

Ted wrote:
> Hi,
>
> I'm trying to sort and group by a custom order, rather than alpha or
> numeric.  In the data below, I would like to have US Legal appear
> before Foreign.  I could add another term, such as position with the
> grouping numbers, but then I lose the nice grouping headers.
>
> Here is a live example, but the sorted groups are alphabetical rather
> than my custom list.
>
> http://libdev.law.columbia.edu/neweres/index.html
>
> {
>     "items": [
>         {
>             "url": "http://www.westlaw.com/";,
>             "label": "Westlaw",
>             "type": [
>                 "US Legal Databases"
>             ],
>             "name": "Westlaw"
>         },
>         {
>             "url": "http://www.lexis.com/xchange";,
>             "label": "LexisNexis",
>             "type": [
>                 "Foreign"
>             ],
>             "name": "LexisNexis"
>         },
>
> <div ex:role="view"
>
>                                    ex:showAll="true"
>                                    ex:orders=".type, .name"
>                                    ex:showToolbox="false"
>                                    class="exhibit-body" >
>       </div>
>
> Any help would be appreciated.  Thanks.
> >
>   


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SIMILE Widgets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/simile-widgets?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to