Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

invalidateCache not working with SelectItem w/ MultipleAppearance.GRID

$
0
0
SmartClient Version: v9.1p_2014-09-17/LGPL Development Only (built 2014-09-17)
Chromium Version 37.0.2062.120 Ubuntu 12.04 (281580) (64-bit)

I want to create a multi-select form field. Certain user actions require the list of options be regenerated from the server. It works if I use MultipleAppearance.PICKLIST. That is, clicking the invalidate cache button in the following example results in a call to the server and the options changing. However, if I use MultipleAppearance.GRID, nothing happens. There is no server request and the options don't change.

Code:

public class TestWindow extends Window
{
        public TestWindow()
        {
                setWidth(300);
                setHeight(400);

                final RestDataSource ds = new RestDataSource()
                {
                        {
                                setDataFormat(DSDataFormat.JSON);

                                DataSourceIntegerField objectId = new DataSourceIntegerField("objectId", "objectId", 32, true);
                                DataSourceTextField fullName = new DataSourceTextField("fullName", "fullName", 32, true);

                                objectId.setPrimaryKey(true);

                                setFields(objectId, fullName);

                                setDataURL("/tds-ws-webapp/gwt-portal/employeeList");

                                final User user = User.getInstance();
                                final Map<String, String> defaultParams = new HashMap<String, String>();
                                defaultParams.put("encryptedUserid", user.getEncryptedUser());
                                defaultParams.put("companyLocationID", user.getCompanyLocationId().toString());

                                super.setDefaultParams(defaultParams);
                        }
                };

                final DynamicForm testForm = new DynamicForm();
                final SelectItem drivers = new SelectItem("drivers", "Drivers");
                drivers.setOptionDataSource(ds);
                drivers.setDisplayField("fullName");
                drivers.setValueField("objectId");
                drivers.setMultiple(true);
                drivers.setMultipleAppearance(MultipleAppearance.GRID);
                testForm.setFields(drivers);

                final Button button = new Button("invalidate cache");
                button.addClickHandler(new ClickHandler()
                {
                        @Override
                        public void onClick(ClickEvent event)
                        {
                                DSResponse dsr = new DSResponse(ds.getID());
                                dsr.setInvalidateCache(true);
                                ds.updateCaches(dsr);
                        }
                });

                addItem(testForm);
                addItem(button);
        }
}

Please advise.

Viewing all articles
Browse latest Browse all 4756

Trending Articles