jQuery UI Widgets Forums Vue How to manipulate instances created by jqwidgets in another domain

Tagged: ,

This topic contains 1 reply, has 2 voices, and was last updated by  Hristo 4 years, 5 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • JenkeNg
    Participant
    
    mounted() {
       let selector = document.getElementById('selector')
       selector.addEventHandle((event)=>{
         console.log(event)
         (An error will be reported here, is there any way?)
       })
    },
    methods:{
      createSelector(){
        initTools: function (type, index, tool, menuToolIninitialization) {
          switch (index) {
           case 0:
           let selectorContainer = document.createElement("div");
           selectorContainer.id = "selector";
           tool[0].appendChild(selectorContainer);
    
           jqwidgets.createInstance('#selector','jqxComboBox',{
              ...
           })
           break;
          }
        }
      }
    }
    

    As shown in the above code, how do I get the instance object created in another code block in another code block, and then manipulate this instance object? Similar to jquery’s

    
    $('#comboBox').on('select',function(){
      ...
    })
    

    Hristo
    Participant

    Hello JenkeNg,

    You could try to use different approaches.
    For example, you could directly bind to the event of this widget.
    Please, take a look at this code snippet:

    tool.on("select", function (event) {
    	let args = event.args;
    	let index = args.index;
        let item = args.item;
        // get item's label and value.
        let label = item.label;
        let value = item.value;
    });

    Or if you want to bind to event of newer instance then you could try this one:

    let combobox = jqwidgets.createInstance('#selector','jqxComboBox',{
    	...
    });
    
    combobox.addEventHandler("open", _ => {
    	console.log("open");
    });

    I hope this will help.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.