Home Analyst Portal

Trigger events on change of Support Group drop down value

David_WellsDavid_Wells Customer Adept IT Monkey ✭✭
Hi Brains Trust,

Similar to this https://community.cireson.com/discussion/2216/ and https://community.cireson.com/discussion/3214/

I want to trigger some js when the Support Group field is updated.

My problem is that the referencing the combobox which doesn't appear to have an id.

First try:

pageForm.viewModel.SupportGroup.bind("change", function(){do stuff}) 

however unlike the "RequestedWorkItem" this is the data for the combo box rather than the input of the drop down itself and so nothing triggers

Second Try:

$("label[for="SupportGroup]").parent().find("input:first").bind("change",function(){do stuff})

but this doesn't work either.

Any guidance most gratefully recieved.

Answers

  • Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
    edited October 2017
    You are close, but you have to approach it the way the Kendo control wants you to, in order for it to work.  Try this:

    $('input[name="SupportGroup"]').data('kendoAutoComplete').bind('change',function() { do stuff });

  • David_WellsDavid_Wells Customer Adept IT Monkey ✭✭
    I get a null returned for $('input[name="SupportGroup"]').data('kendoAutoComplete')
  • Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
    I get a null returned for $('input[name="SupportGroup"]').data('kendoAutoComplete')
    That is because I mixed up the support group and assigned user fields.  The latter is an AutoComplete, the former is a ComboBox.

    Try this:

    // Set the support group field based on what type of work item, since they have different field names
    switch (pageForm.viewModel.Id.substring(0, 2)) {
    	case "IR":
    		supportGroupName = 'TierQueue';
    		break;
    	default:
    		supportGroupName = 'SupportGroup';
    		break;
    }
    supportGroupFld = $("[data-role='" + supportGroupName + "'] input[data-role='combobox']").data('kendoComboBox');


  • David_WellsDavid_Wells Customer Adept IT Monkey ✭✭
    Thanks, this returns the object but unfortunately the event is not triggering, probably my poor non-existent JS skills.

     If (on a change request) I have:
     
    $("[data-role='SupportGroup'] input[data-role='combobox']").data('kendoComboBox').bind("Change", function(){alert("updated")});

    I would expect a alert on changing the drop down, but this is not happening.
  • Geoff_RossGeoff_Ross Cireson Consultant O.G.
    Hi David,

    This works

    $("[data-role='SupportGroup'] input[data-role='combobox']").kendoComboBox({
      change: function(e) {
        alert("updated")
      }
    });
    The next challenge will be getting the timing right for custom.js to run that code on the page but only once the combobox has been created. Good luck.

    Geoff
  • David_WellsDavid_Wells Customer Adept IT Monkey ✭✭
    Thanks Geoff,

    Getting closer. The event triggers if I put the cursor in the drop down and hit enter after changing the drop down value, rather than just when the drop down value changes.
Sign In or Register to comment.