Class: HSelectTag
- Defined in:
- lib/hwidgets/hselecttag.rb
Instance Attribute Summary
Attributes inherited from HGroupTag
Attributes inherited from HWidget
Instance Method Summary collapse
- #html ⇒ Object
-
#initialize(name = nil, modelName = nil, placeholder = nil, **args) ⇒ HSelectTag
constructor
A new instance of HSelectTag.
Methods inherited from HGroupTag
#setCarriageReturn, #setItems, #setItemsAndValues, #setSelected, #setValues
Methods inherited from HWidget
#_addJsSlot, #_set, #_setStyle, #addJsFunction, #appendChild, #appendChilds, #buildSignature, #closeTag, #connect, #copyConstructor, #get, #getChilds, #getElementBy, #getSystemProperty, #hotLog, #openTag, #replacePlaceholder, #reset, #set, #setChilds, #setCloseTag, #setClosedTag, #setEnablePlaceholder, #setInnerHTML, #setParent, #setPlaceholder, #setPlaceholders, #setProperties, #setSlots, #setStyle, #setStyles, #setSystemProperties, #setSystemProperty, #setTag, #storeSlots, #storeStyle, #strProperties, test, #unset, widgetSpace
Constructor Details
#initialize(name = nil, modelName = nil, placeholder = nil, **args) ⇒ HSelectTag
Returns a new instance of HSelectTag.
8 9 10 11 12 13 |
# File 'lib/hwidgets/hselecttag.rb', line 8 def initialize(name = nil, modelName = nil, placeholder = nil, **args) super(name, modelName, placeholder, args) self.setTag("select") self.set(name: @modelName, id: "#{@modelName.gsub('[', '_').gsub(']', '')}") return self end |
Instance Method Details
#html ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/hwidgets/hselecttag.rb', line 15 def html() self.reset() for i in (0..@items.count - 1) do item = @items[i] value = @values[i] option = HWidget.new("option").setInnerHTML(item.to_s).set(value: value) # value || item: se value e' diverso da nil usa value altrimenti item option.set(selected: nil) if ((value || item) == @selectedItem.to_s) self << option end return super() end |