anchor.diff:  
   
   <script>
  -
   	// TODO: Port it on separated js
   	setTimeout(function () {
   		var inputNSelects = $('.input-nselect')
  
positive.code: <div class="form-control input-nselect <% @width %>">
  	<% @select_inputs.each_with_index do |select_input, index| %>
  
  	<div class="form-control <% if @select_inputs.length % 3 == 0 %> third <% else %> half <% end %>"
  		data-api-url="<%= select_input[:api_url] %>" data-value-field="<%= select_input[:value_field] %>"
  		data-label-field="<%= select_input[:label_field] %>" data-value-id="<%= index %>">
  
  		<label class="form-label"><%= select_input[:label] %></label>
  		<input class="select select-nselect" type="text" name="<%= select_input[:name] %>"
  		value="<%= select_input[:value] %>">
  
  	</div>
  
negative.code: 			manageInputNSelect(inputNSelect)
  		})
  	}, 1000)
  	// Main function for each cell
  	var manageInputNSelect = function(inputNSelect) {
  		var selectInputs = $(inputNSelect).find('.form-control')
  		// init first select
  		initSelect(null, 0, selectInputs)
  	}
  	// Function to init a select with the call of the api
  	var initSelect = function (filterId, selectInputPosition, selectInputs) {
  		var selectInput = selectInputs[selectInputPosition]
  		if (!selectInput) { return }
  		var apiUrl = $(selectInput).attr('data-api-url')
  		$.ajax({
  			url: apiUrl,
  			cache: false,
  			data: (filterId ? {filter_id: filterId} : null),
  			success: function (response) {
  				updateSelectize(response, selectInputPosition, selectInputs)
  			}
  		})
  	}
  	// Function to init a selectize with correct options
  	var updateSelectize = function (options, selectInputPosition, selectInputs) {
  		var selectInput = selectInputs[selectInputPosition]
  		var input = $(selectInput).find('.select-nselect')
  		var valueField = $(selectInput).attr('data-value-field')
  		var labelField = $(selectInput).attr('data-label-field')
  		var id = $(selectInput).attr('data-value-id')
  		var initialVal = $(input).val()
  		var selectize = $(input)[0].selectize
  		console.log('selectize for ' + id, selectize)
  		if (selectize) {
  			selectize.clear()
  			selectize.clearOptions()
  			selectize.load(function(callback) {
  			    callback(options)
  			})
  			if (initialVal) {
  				selectize.setValue(initialVal)
  				initSelect(initialVal, parseInt(id) + 1, selectInputs)
  			}
  		} else {
  			input.selectize({
  				maxItems: 1,
  				valueField: valueField,
  				labelField: labelField,
  				searchField: labelField,
  				options: options,
  				onChange: function (value) {
  					initSelect(value, parseInt(id) + 1, selectInputs)
  				},
  				onInitialize: function() {
  					if (initialVal) {
  						this.setValue(initialVal)
  						initSelect(initialVal, parseInt(id) + 1, selectInputs)
  					}
  	      }
  			})
  		}
  	}
  </script>