Changeset 1479


Ignore:
Timestamp:
Feb 2, 2011, 4:21:13 PM (6 years ago)
Author:
t.w.abma@…
Message:
  • when trying to set duplicate properties, the user gets warned this is not possible
Location:
trunk/grails-app
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/taglib/dbnp/importer/ImporterTagLib.groovy

    r1469 r1479  
    133133                def mostsimilar = ImporterService.mostSimilar(matchvalue, options)
    134134
    135                 def res = "<select style=\"font-size:10px\" name=\"${name}.index.${columnIndex}\">"
     135                def res = "<select style=\"font-size:10px\" id=\"${name}.index.${columnIndex}\" name=\"${name}.index.${columnIndex}\">"
    136136
    137137                res += "<option value=\"dontimport\">Don't import</option>"
  • trunk/grails-app/views/importer/common/_on_page.gsp

    r1467 r1479  
    8181        }
    8282
    83 
    8483        /**
    8584         * Update one select based on another select
  • trunk/grails-app/views/importer/common/_properties_horizontal.gsp

    r1456 r1479  
    1515%>
    1616<script type="text/javascript">
     17
    1718// for each select field on the page
    1819$(document).ready(function() {
     20
     21$('select[name^=columnproperty.index.]').each ( function() {
     22
     23  $(this).bind('change', function(e) {
     24      //console.log($(this).val())     
     25      var selection = $(this)
     26
     27      $('select[name^=columnproperty.index.] option:selected').each ( function() {
     28        var selector = $(this)
     29       
     30        if (selection.attr('id') != selector.parent().attr('id') && (selection.val()!="dontimport"))
     31          if ($(this).val() == selection.val()) {
     32            selection.val($('option:first', selection).val());
     33
     34            alert("Property is already set for an other column, please choose a different property.")
     35            return false
     36          }
     37      });     
     38   
     39  });
     40 
     41});
    1942
    2043$('#clearselect').click(function() {
     
    2750
    2851});
     52
    2953
    3054});
Note: See TracChangeset for help on using the changeset viewer.