Changeset 29444


Ignore:
Timestamp:
11/17/14 16:16:35 (6 years ago)
Author:
sjs49
Message:

Refactored code a little to remove some unecessary function parameters relating to drawing objects on left and right side of comparison page

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/model-sites-dev/von-sparql/js/von-sparql-comparison-setup.js

    r29434 r29444  
    6262
    6363    //Draw buttons, etc for each side of page
    64     drawSide("left",leftCollection);
    65     apply_functions("left",leftCollection);
    66     drawSide("right",rightCollection);
    67     apply_functions("right",rightCollection);
     64    drawSide("left");
     65    apply_functions("left");
     66    drawSide("right");
     67    apply_functions("right");
    6868   
    6969    //apply css to generated objects
     
    100100
    101101//Redraw a side, given the collection name
    102 function drawSide(side, collectionName){
     102function drawSide(side){
     103    var collectionName = $("#sel_" + side + "Collection").val();
    103104    $('#span_' + side + 'Name').html(collectionName);
    104105    drawOverview(collectionName, ("div_" + side + "Overview"));
     
    186187
    187188//Apply functions to various elements
    188 function apply_functions(side, collection){
     189function apply_functions(side){
    189190
    190191    //Create jquery UI comboboxes
    191192    $('#div_' + side + 'RefineControls select').combobox({
    192193        select: function(event, ui) {
     194        var collectionValue = $("#sel_" + side + "Collection").val();
    193195            var id = event.target.id;
    194196            if(id == "sel_" + side + "Predicate")
    195                 updateValueSelector(this.value,"sel_"+ side + "PredicateValue", collection);
     197                updateValueSelector(this.value,"sel_"+ side + "PredicateValue", collectionValue);
    196198        }
    197199    });
     
    199201    $('#btn_' + side + 'ShowChart').on('click',function(){
    200202        hardLimit=2000;
    201         drawFilteredDataset(side, collection);
     203        var collectionValue = $("#sel_" + side + "Collection").val();
     204        drawFilteredDataset(side, collectionValue);
    202205    });
    203206
    204207    $('#btn_' + side + 'ShowQuery').on('click',function(){
     208        var collectionValue = $("#sel_" + side + "Collection").val();
    205209        hardLimit=2000;
    206         alert(generateQuery(side,collection)); 
     210        alert(generateQuery(side,collectionValue));
    207211    });
    208212
     
    215219
    216220    //When a <tr> in overview table is selected, select in predicate dropdown
    217 $(document).on("click", "#div_" + side + "Overview.overview tr", function(){
     221    $(document).on("click", "#div_" + side + "Overview.overview tr", function(){
     222        var collectionValue = $("#sel_" + side + "Collection").val();
    218223        var clickedText = tidyPredicate($(this).children(":first").text());
    219224        $('#sel_' + side + 'Predicate option[text="' + clickedText + '"]').attr('selected','selected');
     
    223228       
    224229        $('#sel_' + side + 'Predicate').siblings('.custom-combobox').find('.custom-combobox-input').val(clickedText);
    225         updateValueSelector($('#sel_' + side + 'Predicate option:selected').val(),"sel_"+ side + "PredicateValue", collection);
     230        updateValueSelector($('#sel_' + side + 'Predicate option:selected').val(),"sel_"+ side + "PredicateValue", collectionValue);
    226231
    227232        if($('#cb_quickSearch').is(':checked')) {   
    228233            hardLimit=500;
    229             drawFilteredDataset(side, collection);
     234            drawFilteredDataset(side, collectionValue);
    230235        }
    231236       
Note: See TracChangeset for help on using the changeset viewer.