1

Hi I am using angular with jqxWidget. In that I am using jqxInput which should update/load source based on user input values and the source datatype is json.

Here I am able to get the data from the service, but in the dropdown it doesn't show until and unless I move my cursor in the jqxInputComponent textbox back.

import { jqxInputComponent }    from 'jqwidgets-ng/jqxinput';
@ViewChild('inputReference', {static: false}) myInput: jqxInputComponent;
// during input I am trying to search contact details

  source = {
    datatype: 'json',
    datafields: [{
      name: 'label',
      type: 'label'
    },
    {
      name: 'value',
      type: 'value'
    }],
    localdata: [],
    data: {
      maxRows:10
    }
  }

  oninput(event){
    this.dataAdaptor = new jqx.dataAdapter(this.source);
    this.contactService.search(event.args.item.value).subscribe( res => {

      // Some code to checking normal conditions then finding value
      //After checking conditions running below code
      let data = res.resObj.map((item) => {
        return {
          label: item.userName,
          value: item.ZoneKey
        };
      });
      this.source.localdata = data;

      // I am able to get correct response format till here
      this.dataAdaptor = new jqx.dataAdapter(this.source);

      // here when I am trying to open dropdown/suggesion, it shows null
      this.myInput.opened(true);
      // it shows values only on change on cursor position.

    });
  }

Please let me know if you have any suggestion using jqxInput.

RKD
  • 33
  • 1
  • 8

0 Answers0