Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
110
Notification for WebDropDown loadItems call completion
posted

Hi,

I am working on a complex page and one of the WebDropDowns triggers the values in another WebDropDown. When a value is selected in the first dropdown, the client-side handler will call the loadItems function of the second dropdown to retrieve the values from the server.

The default behavior of the second dropdown is to load the new values and not change the selected values. I would like to have the first item of the new list selected. I tried selecting the new values using a couple of ways (in Javascript) without success. And then I found out that it is caused by the delay in retrieving the new values. What happens is the selection happened before the new values arrives the client-side, so one of the values from the old list was selected.

I am wondering if there is any type of notification (event or something like that) that will let me know I can go ahead and make a selection. Or alternatively if I can force the selection of the first value in the new list, it will work too.

I have built a simple page to demonstrate what I am trying to do. (Please drop .txt from the attachment to see the files, I can't unload a .zip)

There are two dropdowns in the page, and in the first dropdown I have the values {0, 1, 2, 3}, which will trigger {000, 001, 002} in the second dropdown if 0 is selected, {101, 101, 102} if 1 is selected, and so on.

In the server-side event WebDropDown2_ItemsRequested, which handles the on-demand call, I have added a randomize 0 to 1 sec delay . On the client-side, the event that handles the first dropdown selection will select a value in the second dropdown 0.5 sec after calling loadItem (using using setTimeout). There are also two commented functions that will make the selection immediately after calling loadItems to be used for additional testing. Using the current function, half the time you'll see the item being selected from the correct list, and half the time you'll see the item being selected from the list that belongs to the previous selection.

I basically build my page using the example in here: https://es.infragistics.com/samples/aspnet/drop-down/cascade
Under WebDropDown -> Cascade. What is being shown there is almost perfect except that I wanted the State to be updated immediately after a new Country is being selected. In this example, it is possible to submit a page with USA and Alberta selected (which does not make sense to me of course).

I'd appreciate any thoughts on this.

Thanks.

FT.

Parents
No Data
Reply Children