 			generate$option = (option) =>
 				$option = $ """<li class="select7__option #{option.class or ""}"></li>"""
 				if @config.optionTemplate
-					$option.html @config.optionTemplate option
+					$option.html @config.optionTemplate.call @, option, @items
 				else
 					$option.text option.title
 				$option.addClass "select7__option_disabled" if option.disabled

				hasCurrent = no
				$label = $ """<span class="select7__optgroup-label"></span>"""
				if @config.optgroupTemplate
					$label.html @config.optgroupTemplate optgroup
				else
					$label.text optgroup.title
				$optgroup.append $label

			@config.collapseOptgroups = on if @$el.is ".select7_collapse_optgroups"
			{templateOptionFnName, templateOptgroupFnName, templateCurrentFnName} = @$el.data()
			if templateOptionFnName
				@config.optionTemplate = (args...) ->
					window[templateOptionFnName].call @, args...
			if templateOptgroupFnName
				@config.optgroupTemplate = (args...) ->
					window[templateOptgroupFnName].call @, args...
			if templateCurrentFnName
				@config.currentTemplate = (args...) ->
					window[templateCurrentFnName].call @, args...
			@updateItemsAndSelected()
			@opened = no
			@pwnSelect()
