Current filter:
                                You should refresh the page.
                                  • I have a scenario there I need to select multiple items. I use multiple dxSelectBox controls. These controls are bound to CustomDataSource that loads data through REST API.
                                    I have a requirement to exclude already selected items from drop down list options if other selected boxes already contain that item. I apply additional filtering on CustomDataSource loading event to exclude certain IDs.

                                    What I noticed is that dxSelectBox does not request data each time it is expanded. It uses internal cache. This is demo of cache usage:
                                    https://codepen.io/vsimonaitis/pen/BXOdoP?&editable=true
                                    Expand the list. Toast appears.
                                    Exapand the list second time. No toast means no request was made to datasource.

                                    Question is - how can I force dxSelectBox to ignore its cache and refresh datasource on each dropdown expand?

                                1 Solution

                                Creation Date Importance Sort by

                                Hi,

                                There is no built-in option to disable this behavior.

                                As an immediate solution you can define onOpened to manually clear items and load data. For instance, check the following example - https://codepen.io/ArtemDevExpress/pen/ymRYNp?editors=0010

                                Let us know if this suggestion helps.

                                • Rune Skarbo 08.12.2019

                                  Thanks Artem for the suggestion.
                                  Your suggestion solves the cache problem but there is one drawback in you proposal:
                                  when I open dropdown for the first time, the message in the opened menu is showing "Loading" message.
                                  when I open it for the second time, the message in the menu is showing "No data to display", and then loads the data after a while. The message is confusing. Is there a way to show "loading" instead or hide the panel until the data is loaded?

                                • Artem (DevExpress Support) 08.12.2019

                                  Hi Rune,
                                   
                                  The loading panel is not displayed because data was loaded for the first time. You can re-assign the 'dataSource' option instead of calling the load method to clear DataSource cache.
                                  See the modified example - https://codepen.io/ArtemDevExpress/pen/ymRYNp?editors=0010

                                • Rune Skarbo 08.14.2019

                                  Hello Artem,

                                  Thank you, for the response. Your suggestion is very close what we need but it still does not load data in certain cases.

                                  To reproduce:
                                  In the solution you've made, select any item
                                  Press the dropdown to open the list of selection and select item.
                                  For the 3rd time selecting an item the dropdown bypasses the datasource and loads data from cache.

                                  Previous solution also has same issue.

                                • Artem (DevExpress Support) 08.14.2019

                                  Hi Rune,
                                   
                                  The issue occurs because the example throws the E4011 error in the browser console. The error appears because this particular example doesn't have full implementation. It looks like you encounter the same error on your side as well.
                                   
                                  You need to implement both byKey and load for proper operation.

                                  Or you can change the loadMode and cacheRawData options.
                                  For instance, check the following example - https://codepen.io/ArtemDevExpress/pen/ymRYNp?editors=0010
                                   
                                  Let me know if these suggestions help.