Add custom combobox to Wavemaker
Dear Friends,
Can anyone, please help me by telling me the step by step process of, how to manage and add custom combobox to Wavemaker on the dialog.
Thanks,
Anna W Brown
Dear Friends,
Can anyone, please help me by telling me the step by step process of, how to manage and add custom combobox to Wavemaker on the dialog.
Thanks,
Anna W Brown
Well if you have an editable grid, and your editable column needs a ComboBox as an editor, follow this method:
Â
Â
Field name: Name of Grid’s field
Options: Array of strings as options for the ComboBox
Â
As an example to add a ComboBox to a grid of employees to specify their manager, assuming that manager is a related table:
var data = this.managerLiveVariable.getData();
var options = [];
for (var i = 0; i < data.length; i++)
  options.push(data[i].firstname + " " + data[i].lastname);
this.dojoGrid1.setColumnComboBoxOptions("manager", options);
Â
To map this display value back to the original data value:
getManagerIdByName: function(inName) {
var data = this.managerLiveVariable.getData();
for (var i = 0; i < data.length; i++) {
  if (data[i].firstname + " " + data[i].lastname == inName) {
      return data[i].managerid;
  }
  return 0;
}
dojoGrid1CellEditted: function(inSender, inValue, inRowIndex, inFieldName) {
  var rowData = this.dojoGrid1.getRow(inRowIndex);
  if (inFieldName == "manager") {
      var managerId = this.getManagerIdByName(inValue);
      this.writeUserVar.sourceData.setData({
             "userid": rowData.userid,
             "manager": {"managerid": managerId}});
      this.writeUserVar.update();
  }
}
Â