Class: HDBComboBox
- Defined in:
- lib/hwidgets/hdbcombobox.rb
Instance Attribute Summary collapse
-
#editButton ⇒ Object
Returns the value of attribute editButton.
-
#newButton ⇒ Object
Returns the value of attribute newButton.
-
#selectTag ⇒ Object
Returns the value of attribute selectTag.
Attributes inherited from HWidget
Instance Method Summary collapse
- #closeButton ⇒ Object
- #edit(recordId) ⇒ Object
- #html(selectedValue = @selectedValue) ⇒ Object
-
#initialize(moduleName, odb, fieldName, showedFieldName, label, selectedValue, oid, dialogLevel) ⇒ HDBComboBox
constructor
fieldName: products_id showField: name.
- #newRecord ⇒ Object
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(moduleName, odb, fieldName, showedFieldName, label, selectedValue, oid, dialogLevel) ⇒ HDBComboBox
fieldName: products_id showField: name
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/hwidgets/hdbcombobox.rb', line 13 def initialize(moduleName, odb, fieldName, showedFieldName, label, selectedValue, oid, dialogLevel) @odb = odb @fieldName = fieldName @showedFieldName = showedFieldName @label = label @selectedValue = selectedValue @oid = oid @dialogLevel = dialogLevel @sourceModelName = odb.source.modelName @moduleName = moduleName @modelName = odb.modelName super(id: oid) @selectTag = HSelectTag.new("id", "#{@sourceModelName}[#{fieldName}]", label) @selectTag.setCarriageReturn() @selectTag.set(id: "#{@modelName}-combobox", overwrite: true) self << @selectTag self << @newButton = HInputTag.init(name: "new", type: "button") @newButton.connect(:onclick, self, "newRecord", getElem: "body", mode: "add", id: @oid); self << @editButton = HInputTag.init(name: "edit", type: "button") @editButton.connect(:onclick, self, "edit", attributeById: "#{@modelName}-combobox", attributes: ":obj.value", getElem: "body", mode: "add", id: @oid); end |
Instance Attribute Details
#editButton ⇒ Object
Returns the value of attribute editButton.
8 9 10 |
# File 'lib/hwidgets/hdbcombobox.rb', line 8 def editButton @editButton end |
#newButton ⇒ Object
Returns the value of attribute newButton.
8 9 10 |
# File 'lib/hwidgets/hdbcombobox.rb', line 8 def newButton @newButton end |
#selectTag ⇒ Object
Returns the value of attribute selectTag.
8 9 10 |
# File 'lib/hwidgets/hdbcombobox.rb', line 8 def selectTag @selectTag end |
Instance Method Details
#closeButton ⇒ Object
50 51 52 53 |
# File 'lib/hwidgets/hdbcombobox.rb', line 50 def closeButton() puts "closeButton".red return nil end |
#edit(recordId) ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/hwidgets/hdbcombobox.rb', line 55 def edit(recordId) puts "recordId: #{recordId}".red dialogView = HDBDialogView.new(recordId, @moduleName, @odb, @oid, @dialogLevel) dialogView.closeButton.connect(:onclick, self, "closeButton", before: 'hdialogView.close()', mode: 'none', id: @oid) dialogView.connect(:onsubmit, self, "html", submit: true, id: @oid, args:[recordId]) return dialogView.html(:edit) end |
#html(selectedValue = @selectedValue) ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/hwidgets/hdbcombobox.rb', line 39 def html(selectedValue = @selectedValue) puts "#############################################@:#{selectedValue}".red fieldTable = @odb.toFieldTable @selectTag.setItems(fieldTable.column(@showedFieldName, "key")).setValues(fieldTable.column("id", :key)) @selectTag.setSelected(selectedValue) if (selectedValue) return super() end |
#newRecord ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/hwidgets/hdbcombobox.rb', line 63 def newRecord() nvr = @odb.create # new virtual record dialogView = HDBDialogView.new(nvr.id, @moduleName, @odb, @oid, @dialogLevel) dialogView.closeButton.connect(:onclick, self, "closeButton", before: 'hdialogView.close()', mode: 'none', id: @oid) dialogView.connect(:onsubmit, self, "html", submit: true, id: @oid, args:["#{nvr.id}#"]) return dialogView.html(:new) end |