jQWidgets Forums

jQuery UI Widgets Forums Angular Multi pre Select ComboBox

This topic contains 7 replies, has 4 voices, and was last updated by  svetoslav_borislavov 2 years, 1 month ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
  • Multi pre Select ComboBox #132587

    rmk3200
    Participant

    Hi there,
    I have been trying to place my data on combo box, which are in combo box source.
    My data vales are fetching from server call in ngOnInIt, but here your combo box preselect values functionality is available on ngAfterViewInIt.
    Whereas ngAfterViewInIt is called before completion of ngOnInIt in angular. How do i update combo box with later received data?

    Multi pre Select ComboBox #132593

    steven_peterson8
    Participant

    Hi,

    Just change the source property of the Combo box and then set the selected index.

    Here is an example: http://jsfiddle.net/edh6nts4/

    I hope this helps!

    Best regards,
    Steve Peterson

    jQWidgets Team
    https://www.jqwidgets.com/

    Multi pre Select ComboBox #132599

    rmk3200
    Participant

    You didn’t get my requirement. the source has actual or all values as well. I would like to present as pre selected values which are already saved to my data. This call is an editing info of a record which is already saved with some data. I exactly needed like demo of your pre selected values combo box. But it is not happening because of data is not available when ngAfterInIt called. After ngAfterInIt called data getting triggered and received in ngOnInIt. So we cannot stop ng life cycle until data response in ngOnInIt.

    The previous response from you has a example is not suits for ng life cycle. Whatever source/ Set combo will show. But data availability on server call is fully dependent on ngOnInIt. ngAfterInIt never wait until ngOnInIt completely has resolved data. We cannot implement pre selected combo box without data.
    When i use same combo box with all source in new record selection will work proper.
    Find the image to get understand better.
    Issue with pre multi select combo

    Multi pre Select ComboBox #132602

    Hi,

    Yes, as you said you cannot stop the lifecycle. The call is async which means the data will be received later.
    You don’t know when. So the preselection will happen after the data is received. This is not a problem on our side.
    A possible solution would be to display some loader until the data is fetched

    Best regards,
    Svetoslav Borislavov

    jQWidgets Team
    https://www.jqwidgets.com/

    Multi pre Select ComboBox #132603

    rmk3200
    Participant

    no loader will not useful for waiting for data. Because only once ngAfterInIt will called whether you have data or not, Loader true or false whatever available values it will get excuted.
    You have to make your implementation to suits for ngOnInIt as well, until combo box pre select feature is worthless.

    Multi pre Select ComboBox #132605

    ivanpeevski
    Participant

    Hi rmk3200,

    Please see the example here: stackblitz

    You can set selection inside of the “loadComplete” function of the dataAdapter. By the time it is called, the combobox will already exist

    Best regards,
    Ivan Peevski
    jQWidgets Team
    https://www.jqwidgets.com/

    Multi pre Select ComboBox #132608

    rmk3200
    Participant

    my source is one dimensional string array is fetching from server. why work around with data adaptor? can’t show combo box that what i have?
    By this i need to change actual source and edit_source as per your reference. and selectIndex is not worked for me.
    Can you give me another example of 1D array with strings to preselect the array values on ngOnInIt?

    Multi pre Select ComboBox #132612

    Hi,

    The dataAdapter is used for its loadComplete method. This way you can select the indexes after the items are loaded.
    Another option is with the method onBindingComplete but in setTimeout.
    You can have a dataAdapter with an array. https://stackblitz.com/edit/github-7lqwxv-32oawf?file=src/app/app.component.ts
    Here is an example with the onBindingComplete: https://stackblitz.com/edit/github-7lqwxv-qgj1sx?file=src/app/app.component.ts

    Best regards,
    Svetoslav Borislavov

    jQWidgets Team
    https://www.jqwidgets.com/

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

You must be logged in to reply to this topic.