source: trunk/grails-app/views/importer/common/_properties_horizontal.gsp @ 1480

Last change on this file since 1480 was 1480, checked in by t.w.abma@…, 13 years ago
  • all possible properties are shown in the select boxes (allfieldtypes=true)
  • Property svn:keywords set to Rev Author Date
File size: 2.8 KB
Line 
1<%@ page import="org.dbnp.gdt.GdtService" %>
2<%
3        /**
4         * Properties template which shows entities and allows to assign properties to columns
5         *
6         * @author Tjeerd Abma
7         * @since 20100210
8         * @package importer
9         *
10         * Revision information:
11         * $Rev: 1480 $
12         * $Author: t.w.abma@umcutrecht.nl $
13         * $Date: 2011-02-02 15:24:55 +0000 (wo, 02 feb 2011) $
14         */
15%>
16<script type="text/javascript">
17
18// for each select field on the page
19$(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});
42
43$('#clearselect').click(function() {
44
45  // for each select field on the page
46  $("select").each( function(){
47    // set its value to its first option
48    $(this).val($('option:first', this).val());
49  });
50
51});
52
53
54});
55</script>
56<!-- saveproperties action was defined in the form -->
57    <table>
58          <g:each var="stdentity" in ="${GdtService.cachedEntities}">
59              <% if (importer_selectedentities.any { it.name.toLowerCase() == stdentity.entity.toLowerCase() } && stdentity.entity!="") { %>
60           
61              <tr><td colspan="3"><h4>${stdentity.name}</h4></td></tr>
62                <tr>
63            <td class="header" width="25px"><input id="clearselect" type="button" value="clear" name="clearselect"></td>
64            <g:each var="selentity" in="${importer_selectedentities}">
65              <g:if test="${selentity.name.toLowerCase()==stdentity.entity.toLowerCase()}">
66                            <td class="header" width="200px">
67                                <b>${importer_header[selentity.columnindex.toInteger()].name}</b>
68                  <importer:propertyChooser name="columnproperty" mappingcolumn="${importer_header[selentity.columnindex.toInteger()]}" matchvalue="${importer_header[selentity.columnindex.toInteger()].name}" template_id="${importer_template_id}" allfieldtypes="true"/>
69                            </td>                                       
70              </g:if>
71            </g:each>
72                </tr>
73
74        <g:each var="row" in="${session.importer_datamatrix}">
75                <tr>
76                  <td class="datamatrix">                   
77                  </td>
78                    <g:each var="cell" in="${row}">
79                        <td class="datamatrix">
80                            <g:if test="${cell.toString()==''}">.</g:if>
81                            <g:else><importer:displayCell cell="${cell}"/></g:else>
82                        </td>
83                    </g:each>
84                </tr>
85                </g:each>
86
87          <% }  %> <!-- end of JSP if-->
88          </g:each>
89    </table>
Note: See TracBrowser for help on using the repository browser.