Sorry if the pictures don't come through...

The values that I have in an attribute are a facet that I want to display in 
the sidebar.  However, the values are urns and I would like to display the 
English words instead.  I can see in sidebar.js where these lists are being 
created.  Now, I do have more than one facet so I only want to do this for one 
of the facets, which complicates it a bit, but I'm not quite sure how to go 
back far enough in the javascript to figure out where I can do the 
substitution.  "valueEscaped" appears to be where I want to display the English 
words.  To go back from there, it would appear that all of this is in 
"facetData" which seems to come from "data".   Though, I'm not particularly 
adept at javascript.

Is there a way to create the "value" in the "data" before it gets this far - 
like something when the search gets all of the facet data that I can just 
substitute somehow so that by the time it gets to sidebar.js "value" already 
has the "correct" (English words) value in it?  Or is best to create some sort 
of big array here and just do the substitution here if the "constraint" is the 
particular constraint that I want this done for?


sidebar.js

  buildFacet = function (constraint, data) {
        var html = '',
            label,
            facetData,
            listDisplay,
            listHidden,
            listTipdown;
...
facetData = data.facets[constraint].facetValues;
...
if (facetData !== undefined) {
                html += '<ul class="'+listHidden+'">';
                var i, len;
                for (i=0,len=facetData.length; i < len; i = i + 1) {
                                // Handle any quotes in facet data
                                nameEscaped = 
facetData[i].name.toString().replace(/"/g, '&quot;');
                                valueEscaped = 
facetData[i].value.toString().replace(/"/g, '&quot;');
                    // Do not display item if more... unclicked and item number 
over limit
                    itemDisplay = (($.inArray(constraint, moreItems) === -1) && 
(i > limit-1)) ? ' hidden' : '';
                    html += '<li class="facet-item' + itemDisplay + '">'
                         + '<a href="#" rel="'+nameEscaped+'" 
title="'+nameEscaped+'">' + truncateStr(valueEscaped, 32) + '</a> '
                         + '<span class="count">(' + facetData[i].count + 
')</span>'
                         + '</li>';
                }
...
[cid:[email protected]]

[cid:[email protected]]

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to