Resetting a valuelist by code in the browser

Hello,

First of all thank you so much for this forum, I’ve learned a whole lot from you guys!
I am displaying a valuelist(created by code) with radio buttons on a form. At the click of a button I am resetting this valuelist by code. In Smart Client I can see the changes when i press the button (the valuelist is automatically set to the new values on the form). But in the browser this does not happen, i have to click on the field to trigger the changes… I am mentioning that the valuelist is on a global variable… Can you tell me how to see these changes on the form automatically when I press the button ?

Many thanks in advance!
DB

Can you post your method here? Are you using application.setValuelistItems() to “reset the valuelist”?

I changed valuelists in the webclient before, but I haven’t seen the problem you mention.

I did use application.setValuelistItem() method to reset the valuelist.
I tried like this: after I reset by code the valuelist, I set to null the global variable that had the valuelist on. I don’t understant why, but now it works…
DB

I have noticed that if i try and redefine the valuelist without selecting one of the radio buttons before (=giving a value to the global variable that has the valuelist on), te valuelist is no longer updated to the new values unless i click on one of the radio buttons (that triggers the update of the valuelist).Why is this happening? Here is the method that is called when i press my button (regular button,not a radio one):

var vServer1 = forms['webr_training'].controller.getServerName()
vText = globals.webr_gTrainingSearch
vText = '%' + vText + '%'
var vSQL1 = 'SELECT training_id, training_title,training_code FROM training WHERE owner_id = ? AND training_title LIKE ?'
var vDS1 = databaseManager.getDataSetByQuery(vServer1, vSQL1, [globals.webr_gOwnerID,vText], -1)

var vReturn1 = new Array()
var vDisplay1 = new Array()
var vTrainingCode = new Array()
vReturn1 = vDS1.getColumnAsArray(1)
vDisplay1 = vDS1.getColumnAsArray(2)
vTrainingCode = vDS1.getColumnAsArray(3)
for (var i=0; i< vDisplay1.length; i++) {
   vDisplay1[i] = vDisplay1[i] + ' (Code ' + vTrainingCode[i] + ')'
   }

application.setValueListItems( 'webr_training_title',  vDisplay1,  vReturn1,true)
globals.webr_gTrainingID = null

I understand that you did not have this problem with redefining valuelist,can you tell me where am i doing wrong? I am using Servoy 3.5.7.

Did you try an “application.updateUI(50)” after the valuelist change?

As you have probably noticed, I am trying to filter the valuelist according to the letters that the user introduces.
I tried now with application.updateUI(50) after the valuelist change and still no improvement.
It seems that the valuelist is updated when pressing the button only if the global that has the valuelist on is set to a value. I set it to vReturn1[0] when pressing the button and it works, but even then there are times when it ‘freezes’. For example if i introduce ‘c’ in globals.webr_gTrainingSearch, I press the button(works) and then i complete the global to ‘com’, it often ‘freezes’. I have written some ‘application.output()’ methods in the code and from this i am sure that the valuelist is set correctly with every push of the button, I just don’t understand why it is not updated in the browser…
DB

Your code seems ok to me.

Can you reproduce the bug in a small solution? If so, please create a case in the support system with that solution attached.