Reputation: 15
On form load, the combo box is filled with the values from database. So on selection of any of the combo box value, a database query is fired and a table below is filled with values. My question is how to disable the combo box on selection of a combo box value until the values have been fetched from the database. I have used form.disable but it works only till the first batch of values come and not until all the values have been fetched.
Upvotes: 1
Views: 128
Reputation: 7273
If you keep adding data to the table (with multiple asynchronous calls, I guess) even after onChange() has returned , there's no way for the combobox to know it's not supposed to be enabled yet.
You'll have to add logic to check if the table has finished loading or not, be it by comparing against a database COUNT() or by including a "last batch of data" flag in your returned values.
The easiest way would probably be to have the table-loading function enable the combobox when the number of returned values in the batch is less than the expected batch size. So, if you load your table 500 rows at a time, and one call returns only 379 values, that's the last batch and you can enable the combobox then.
Maybe your scenario is more complicated, in that case an example of your code would be necessary.
Upvotes: 0