Matthias,

What you want can be done, but with some Javascript. First, add 
?autoCreate=false to exhibit-api.js:

    <script 
src="................./exhibit-api.js?autoCreate=false"></script>

Then give your type facet an ID

    <div role="facet" id="the-type-facet" ex:expression=".type" ...></div>

Add an body onload handler

    <body onload="onLoad();">

Implement that handler like so

    function onLoad() {
        var fDone = function() {
            window.exhibit = Exhibit.create();
            window.exhibit.configureFromDOM();
            watchCollection();
        };
        window.database = Exhibit.Database.create();
        window.database.loadDataLinks(fDone);
    };

watchCollection is implemented like so

    function watchCollection() {
        window.exhibit.getDefaultCollection().addListener({
            onItemsChanged: checkTypeFacet
        });
    }

    function checkTypeFacet() {
       var facet = window.exhibit.getComponent("the-type-facet");
       var selection = facet._valueSet;
       if (selection.size() == 1) {
           if (selection.contains("typeA")) {
               // if not previously selected typeA, then remove other 
types' facets and create some facets for typeA
           } else if (selection.contains("typeB")) {
               // if not previously selected typeA, then remove other 
types' facets and create some facets for typeB
           }
       } else {
           // multiple selection, hmm...
       }
    }

to create a facet

    function createFacetX() {
        var div = document.createElement("div");
        div.id = "the-facet-X";
        someOtherElementInTheDOM.appendChild(div);

        var facet = Exhibit.ListFacet.create(
            { expression: ".x", facetLabel: "X" },
            div,
            window.exhibit.getUIContext()
        );
        window.exhibit.setComponent("the-facet-X", facet);
    }

to dispose a facet

    window.exhibit.disposeComponent("the-facet-X");
    var div = document.getElementById("the-facet-X");
    div.parentNode.removeChild(div);

Let me know how that goes.

David


Matthias wrote:
> Hi David,
>
> well collapsing the facets would not be enought.
> Let me try to give an example.
>
> As I read in previous messages, the teacher and student example is
> very common, so let's give it a go again.
> There a two types of data entries, teacher and students.
>
> Teachers have the following attributes:
> - label
> - type (acts like to previously mentioned 'domain')
> - school
> - salary
> - subjects taught
>
> While Students have:
> - label
> - type
> - school
> - favourite subject
> - average mark
>
> I now would like to have one view starting only with a type facet, a
> school facet and showing both teachers and students. When the user
> hits a school both, teachers and students are filtered. But if he hit
> a type, lets say Student, only students are shown and the facets
> favourite subject and average mark are shown too. Hitting Teacher
> works are analog. Only teachers and the facets salary and subject
> taught are shown.
>
> Is there a way to do that?
>
> Cheers,
> Matthias
>
>
>
> On 22 Feb., 14:44, David Karger <[email protected]> wrote:
>   
>> Matthias, your description is pretty abstract.  Can you give a more
>> concrete example of how this would be used?  That might help us
>> understand if there is a way to accomplish what you want with the
>> current exhibit framework.  For example, it is already possible to make
>> facets "collapsible" and have them start collapsed if you don't want
>> them cluttering the screen.
>>
>> Matthias wrote:
>>     
>>> Hi everybody,
>>>       
>>> first of all, big compliment. Exhibit is a very nice tool and provides
>>> nearly everything I need.
>>>       
>>> There's only one thing missing.
>>> I would like to create a simple facet view supporting a width range of
>>> data entries. My idea was to specify a set of facets every entry has
>>> to name a value to. Lets say something like: label, type and domain.
>>> The domain facet then would specify which other facets should be used
>>> to search deeper for data entries. That means clicking on a given
>>> domain would trigger the page to show NEW domain specific facets.
>>>       
>>> Is there a way to do this with Exhibit?
>>> Would be very nice to have this feature running!
>>> Thanks in advance.
>>>       
>>> Matthias
>>>       
> >
>   


--~--~---------~--~----~------------~-------~--~----~
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