Removed the options extension because a more powerful version is now baked into Ignite Html directly.
This commit is contained in:
		| @@ -535,40 +535,5 @@ IgniteTemplate.prototype.countries = function(placeholder = null) { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     return this.innerHTML(html); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Generates a series of options from an array of values, or an object of key values pairs. |  | ||||||
|  * @param {Array|Object} options An array of strings or list of key value pairs to create options from. |  | ||||||
|  * @param {*} placeholder The placeholder option, it's value will be 0, if set this text will be shown. |  | ||||||
|  * @returns {IgniteTemplate} This ignite template. |  | ||||||
|  * @example IgniteTemplate.prototype.options([{"Custom value": "Display value"}, "value2", "value3"]); |  | ||||||
|  * @example IgniteTemplate.prototype.options({"value1": "A", "value2": "B"}); |  | ||||||
|  */ |  | ||||||
|  IgniteTemplate.prototype.options = function(options, placeholder = null) { |  | ||||||
|     //Generate html and populate the template with it. |  | ||||||
|     var html = ''; |  | ||||||
|  |  | ||||||
|     if (placeholder) { |  | ||||||
|         html += `<option value='-1'>${placeholder}</option>`; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     if (Array.isArray(options)) { |  | ||||||
|         for (var i = 0; i < options.length; i++) { |  | ||||||
|             if (options[i] instanceof Object) { |  | ||||||
|                 var keys = Object.keys(options[i]); |  | ||||||
|                 html += `<option value='${keys[0]}'>${options[i][keys[0]]}</option>`; |  | ||||||
|             } else { |  | ||||||
|                 html += `<option value='${options[i]}'>${options[i]}</option>`; |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     } else { |  | ||||||
|         var keys = Object.keys(options); |  | ||||||
|         for (var i = 0; i < keys.length; i++) { |  | ||||||
|             html += `<option value='${keys[i]}'>${options[keys[i]]}</option>`; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     return this.innerHTML(html); |     return this.innerHTML(html); | ||||||
| } | } | ||||||
		Reference in New Issue
	
	Block a user