Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
835
Using .delegate() to capture combo box changes
posted

Hi,

I'm trying to use the following in order to capture combo box selection changes, then update the caption to my igGrid (for starters):

 

$(document).delegate(

 "#filterCombo", "igcomboactiveitemchanged", function (evt, ui) {

    var selText = $("#filterCombo").igCombo("text");

  $("#pfGrid").igGrid("option","caption", selText);

});

I can indeed update my grid's "caption"; however I'm always getting the PREVIOUS selection - not the current text item which was just selected.

Also, can you advise me on how to use the evt and ui objects ? i can't find good documentation on that.

 

thank you.

Bob

 

Parents
  • 835
    posted

    I realized I was using the wrong event method, so I changed it to "igcomboselectionchanged":

         $(document).delegate("#filterCombo", "igcomboselectionchanged", function (evt, ui) {      // COMBO BOX CHANGE EVENT !                      
             var selText = $(this).igCombo("text");
             $("#pfGrid").igGrid("option","caption", selText);                  
             
         });

    But still trying to get an understanding of how to use the "evt" and "ui" objects. Any examples please ?

  • 23953
    Verified Answer
    Offline posted in reply to Bob M.

    Hello Bob,

    D. is correct.

    To be more precise, the "evt" and "ui" objects are documented in each event code snippet of the control's API docs.

    Here is an extract from the igCombo.selectionChanged event:

    $(document).delegate(".selector", "igcomboselectionchanged", function (evt, ui) {
         
        //use to obtain reference to the event browser
        evt.originalEvent;
        //use to obtain reference to igCombo
        ui.owner;
        //use to obtain reference to array of new selected items. That can be null.
        ui.items;
         //use to obtain reference to array of old selected items. That can be null.
        ui.oldItems;
                   
    });

    Best regards,
    Martin Pavlov
    Infragistics, Inc.

Reply Children