Auto select option on edit

Auto select option on edit

kaustubh.agrawal2000kaustubh.agrawal2000 Posts: 81Questions: 35Answers: 2

I have a editor form with 3 select boxes which are dependent on each other (Ex:- country, state, city)
I am using buttons plugin to show create & Edit buttons.

When user clicks create button I make an ajax call to get the country list,
When user selects a country I make ajax call to get state list (via dependent)

All, works until now.

The problem is, when the user clicks the edit button,
I want to be able to make ajax call, get the list of countries and auto select the country ... with the value in the row that user wants to edit.

at the moment I have something like

        fields: [
               {
               label : "Country",
               name : "country_id",
               type: "select2",
               ipOpts : getCountryList(),
               opts: {
                   "allowClear": true
                }
           }]

the select on edit, is not auto populating the value in the row to be edited...
same is the case for state and city as well.

Kindly help me with this.

Answers

  • allanallan Posts: 49,486Questions: 1Answers: 7,278 Site admin

    Can you link to a page showing the issue please?

    What does getCountryList() return for example? Is it async or sync (from that code it should be sync, but that's bad for performance)?

    Does it work at all if you use select rather than select2?

    Allan

Sign In or Register to comment.