Maybe adding a non-UI facet just implementing restrict(items) and
hasRestrictions() and adding that to the collection
(exhibit.getCollection('default')) might be easier? Looking at
api/scripts/data/collection.js, that might just work.Axel 2008/1/30, Gavin Robinson <[EMAIL PROTECTED]>: > > I'm trying a slightly different approach to this. What I want to happen is > when a user clicks a link in a single item lens, the view switches to map > view with only that item displayed. So the first step is to filter down to > that one item, then switch views. I've got as far as putting the item's id > into the text search box when the link is clicked, but I don't know what > functions to call next. Changing the value of the search input doesn't seem > to trigger the event that starts the search. So what I need to know is: > > 1. The function to call to trigger a text search. > > 2. The function to call to switch to map view. > > I've been inspecting with Firebug but I can't work out what the first > function to be triggered on the relevant event is (and in the case of text > search I'm not even sure what the event is). > > Am I trying to do something that can't be done? Is there a better way to do > it? > > You can see an example of what I've got so far at: > > http://www.4-lom.com/sandall/place-index2.html > > (This isn't the current live version and isn't linked back to from the rest > of the site - the real one is place-index.html) > > The relevant bits of code are: > > Search facet: > > <div id="searchbox" ex:role="facet" ex:facetClass="TextSearch" > ex:expressions=".label"></div> > > Link in item lens: > > javascript:{} Search for this > > Function in head: > > function filterItem(elmt) { > var itemID = Exhibit.getAttribute(elmt, "itemID"); > var x = > document.getElementById('searchbox').getElementsByTagName("input"); > x[0].value = itemID; > } > > > > David Huynh-2 wrote: > > > > You're on the right track. Try something like this: > > > > <div ex:role="lens" > > ... > > ex:onshow="initializeMap(this);" > > > > > ... > > <div ex:id-subcontent="map-{{value}}" > > ex:latlng-content=".latlng"></div> > > ... > > </div> > > > > And include this Javascript code > > > > <script> > > function initializeMap(elmt) { > > var itemID = elmt.getAttribute("ex:itemID"); > > var mapDiv = document.getElementById("map-" + itemID); > > var latlng = mapDiv.getAttribute("latlng"); > > ... initialize your map ... > > } > > </script> > > > > There is a caveat. Right now there is no handler for disposing the maps > > created inside lenses. That means that when the lenses are disposed > > (simply removed from the DOM), the maps might be leaking memory. > > > > David > > > > Ivan Zhidov wrote: > >> Yes, the map would be rendered in the lens template at first but I'm > >> also looking to popup a map window but need a way to pass 'latLng' > >> parameter from Exhibit data into a function call. > >> > >> What I also noticed is that when lens is rendered, its holding element > >> is assigned ex:itemid="1" for Exhibit management. > >> I don't have a lot of experience with JS/DHTML but would it make sense > >> to assign unique DHMTL id to the values being rendered so you could > >> easily retrieve their values from document.getElementById() ? > >> > >> Ivan > >> > >> From: David Huynh <[EMAIL PROTECTED]> > >> Subject: Re: single item map functionality > >> To: General List <[email protected]> > >> Message-ID: <[EMAIL PROTECTED]> > >> Content-Type: text/plain; charset=ISO-8859-1; format=flowed > >> > >> Do you intend to render a map in a lens template? > >> > >> David > >> > >> Ivan Zhidov wrote: > >> > >>> > Its possible in Exhibit to switch to a Map view to see the item > >>> listed > on Google Map. Is there a way to display a certain single > >>> item on the > map? > >>> > Can I control which item gets displayed via JS somehow? If this > >>> cannot > be easily done out of the box please give me some direction > >>> to follow > to implement this type of functionality. > >>> > > >>> > Ivan > >> > >> _______________________________________________ > >> General mailing list > >> [email protected] > >> http://simile.mit.edu/mailman/listinfo/general > >> > > > > _______________________________________________ > > General mailing list > > [email protected] > > http://simile.mit.edu/mailman/listinfo/general > > > > > > -- > View this message in context: > http://www.nabble.com/single-item-map-functionality-tp14223516p15187857.html > Sent from the SIMILE - General mailing list archive at Nabble.com. > > _______________________________________________ > General mailing list > [email protected] > http://simile.mit.edu/mailman/listinfo/general > _______________________________________________ General mailing list [email protected] http://simile.mit.edu/mailman/listinfo/general
