Ignore:
Timestamp:
Nov 16, 2010, 11:47:46 AM (11 years ago)
Author:
t.w.abma@…
Message:
  • import wizard: fuzzy matching for column properties (step 2) implemented
File:
1 edited

Legend:

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

    r1141 r1143  
    140140    def createPropertySelect(String name, options, matchvalue, Integer columnIndex)
    141141    {
    142         //String.metaClass.mostSimilarTo = { ImporterService.mostSimilar(delegate, it) }
    143         //println "mostsimilar="+ImporterService.mostSimilar(matchvalue, options)
     142        // Determine which field in the options list matches the best with the matchvalue
     143        def mostsimilar = ImporterService.mostSimilar(matchvalue, options)
    144144
    145145        def res = "<select style=\"font-size:10px\" name=\"${name}.index.${columnIndex}\">"
    146146
    147         res += "<option value=\"dontimport\" selected>Don't import</option>"
     147        res += "<option value=\"dontimport\">Don't import</option>"
    148148
    149149        options.each { f ->
    150             res+= "<option value=\"${f.name}\">"
    151            
     150            res+= "<option value=\"${f.name}\""
     151
     152            res+= (mostsimilar.toString().toLowerCase()==f.name.toLowerCase()) ?
     153                    " selected>" :
     154                    ">"
     155           
    152156            res+= (f.preferredIdentifier) ?
    153157                    "${f.name} (IDENTIFIER)</option>" :
Note: See TracChangeset for help on using the changeset viewer.