Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ajax on init #150

Closed
agil-NUBBA opened this issue Apr 5, 2018 · 2 comments
Closed

Ajax on init #150

agil-NUBBA opened this issue Apr 5, 2018 · 2 comments

Comments

@agil-NUBBA
Copy link

agil-NUBBA commented Apr 5, 2018

Hi,

I guess I found a non-covered use-case, I'm working with a update form, where the stored value could be 2, and I'm not able to save the label (text), with a JSON like this comming from the server, and I want to retrive the label (text) from there, right after the page loads:

[
    {
        "value": "1",
        "text": "Chair",
        "class": "string"
    },
    {
        "value": "2",
        "text": "Table",
        "class": "string"
    }
]

Current behaviour

  • The page loads.
  • There is not way to perform an onInit ajax in order to retrieve (some) options, until the user types something.

Expected behaviour would be:

  • The page loads.
  • If the selector has a selected value (with an unknown label), do an ajax to retrieve some options, so you get the label (text) of the selected option.

thanks in advance

@reloxx13
Copy link

reloxx13 commented Nov 28, 2018

if the page loads and you got the selected value, you should also get the label from this selected value.

there is no need for an initial ajax, you need to/have to do it on pageload yourself.
if you dont have that label on pageload, you need to make an ajax before the selectpicker is initialized, this depends on your code or add it where you gather the selected id/form data.

this is a searchajax and not a "get me a label by id ajax".
this is why the use-case is just wrong.

@agil-NUBBA
Copy link
Author

Yep, I ended preloading the options at the backend. Works I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants