Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Hiding unavailable concept in CBC

In SSI Web I used java script to hide the concepts that were unavailable for given respondent: within level of a concept that was to be hidden there was a "tag":
 <span class="ukryj"></span>;
and I had following script in the CBC question footer section:
<script>$('document').ready(function(){$('.ukryj').parent().parent().parent().parent().hide()});</script> .
I does not work fine in Lighthouse when I want concepts to be displayed on multiple rows (the script distorts the concepts layout).
Is there any efficient way to hide unavailable concepts in cbc?
asked Mar 25 by RafalNeska (490 points)

1 Answer

0 votes
This is an interesting question.  I'd like to put some more thought into creating the best solution, but maybe this will work for now:

<script>
$('document').ready(function(){
    $('.ukryj').closest('.cbc_concept').hide();
    $(window).resize();
});

$(window).resize(function(){
    if ($(window).width() > 800) {
        switch ($('.cbc_concept:visible').length - 1) {
            case 1:
                $('.cbc_concept').css('width', '80%');
                break;
            case 2:
                $('.cbc_concept').css('width', '40%');
                break;
            case 3:
                $('.cbc_concept').css('width', '25%');
                break;
            case 4:
                $('.cbc_concept').css('width', '20%');
                break;
        }
    }
})
</script>


Notice those "cases."  Each one has a width to use when that many concepts are being displayed.  You can adjust the exact percentage widths as needed.
answered Mar 25 by Zachary Platinum Sawtooth Software, Inc. (171,950 points)
...