CA Service Management

 View Only

How to create Combobox input (Editable Dropdown) 

Jan 11, 2017 12:54 PM

This thing is needed when your customers wants to select value from existing list and to have possibility to create a new ones but they are too lazy to use Lookups

 

Demonstration

 

Code

 

My attribute called spec located in z_wf_wl factory. Notepad's Replace all function should be enough to refactor this code.

 

form side:

function switchComboBox(obj) {
     if (!jq("#spec_attr").length)
          jq("[pdmqa='spec_fake']").parent().append(
               jq(document.createElement('input'))
               .attr({id : "spec_attr", name : "SET.spec"})
               .hide()
          );
     if (jq(obj).val() == "<NEW_VALUE>")
          jq("#spec_attr").show().val("");
     else
          jq("#spec_attr").hide().val(jq(obj).val());
}
detailSetEventHandler("onchange='switchComboBox(this);'");
detailDropdown("Specialization", "spec_fake", "pri", 1, 40,
     false, "", "$args.spec",
     "no", "spec", "$args.spec",
     "","","no","","",
     "$args.spec",
     <PDM_LIST prefix=list where="spec is not NULL" factory=z_wf_wl domset="spec_types">
          "$list.spec", "$list.spec",
     </PDM_LIST>
     "New Type:", "<NEW_VALUE>"
);

 

spel side:

// Filename: wf_wl.maj
// This one used to list all unique values used for "spec" attribute
OBJECT z_wf_wl {
     FACTORY {
          DOMSET spec_types "spec" STATIC {
               DISTINCT;
          };
     };
};

Statistics
0 Favorited
14 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Related Entries and Links

No Related Resource entered.