It doesn’t make any sense to put this code in the optionDataSource, because this cache is maintained at the DataSource level for all components to access that data source. If that’s what you want you should simply do the fetch at application start up.
You also don’t seem to know what the cacheAllOperationID is for, please re-visit the docs.
If instead you wanted just this combo box to fetch all rows, you just set filterLocally:true.
Announcement
Collapse
No announcement yet.
X
-
Sorry for late reply. I got into some other feature implementation. Now i am back to this. I am able to make successful call to fetch data for items datasource before its drawn up. My intention was that once i ll do fetch against combobox datasource, it ll maintain cache and wont send fetch request again on click of picker icon. but it still sends the new request.
My code is :
Code:comboboxItem.getOptionDataSource().setCacheAllOperationId("abc"); DSRequest rep = new DSRequest(); rep.setOperationId("abc"); rep.setTextMatchStyle(TextMatchStyle.STARTS_WITH); rep.setOperationType(DSOperationType.FETCH); comboboxItem.getOptionDataSource().fetchData(null, null, rep);
Leave a comment:
-
The only fetch operations you have defined have operationIds, but you have not specified an operationId for the fetch.
Leave a comment:
-
Hi,
I have used following code to do fetch
Code:DataSource.get(DataSourceConstant.DROPDOWN_DS).setCacheAllData(true); DataSource.get(DataSourceConstant.DROPDOWN_DS).setCacheAllOperationId("fetchByID"); DataSource.get(DataSourceConstant.DROPDOWN_DS).fetchData();
Code:DataSource.get(DataSourceConstant.DROPDOWN_DS).setCacheAllData(true); DataSource.get(DataSourceConstant.DROPDOWN_DS).setCacheAllOperationId("fetchByID"); DSRequest rep = new DSRequest(); rep.setOperationId("fetchByID"); rep.setOperationType(DSOperationType.FETCH); DataSource.get(DataSourceConstant.DROPDOWN_DS).execute(rep);
Below is my datasource
Code:<DataSource ID="Dropdown" schemaBean="com.assaabloy.cow.shared.dto.DropDownDTO"> <fields> <field name="dropdownId" align="center" primaryKey="true"/> <field name="id" align="center"/> <field name="name" align="center"/> <field name="address" align="center"/> </fields> <operationBindings> <binding operationType="fetch" operationId="fetchByID" serverMethod="getById" beanFactory="org.springframework.beans.factory.BeanFactory" invalidateCache="true"> <serverObject lookupStyle="spring" bean="dropdownService"/> </binding> <binding operationType="fetch" operationId="fetchByCode" serverMethod="getByCode" beanFactory="org.springframework.beans.factory.BeanFactory" invalidateCache="true"> <serverObject lookupStyle="spring" bean="dropdownService"/> </binding> </operationBindings> </DataSource>
Leave a comment:
-
If calling DataSource.fetchData() results in that message, then your DataSource is broken, but you claim it's working elsewhere, so you're giving incorrect information somehow.
Calling fetchData() on the SelectItem will result in data being fetched and cached.
Setting cacheAllData on the DataSource (see docs for details) can be used to create a DataSource-level cache of all available data, shared across any components that access that DataSource.
Leave a comment:
-
Cache at application start
Hi, I am using version 6.1-p20190721.
I have few SelectItems and Combobox in my application pages. All those SelectItems and Comboboxes have datasources attached with them. When i first click on the item, it fetches the data and smarGWT cache it at client side.
I wish to cache this data at application start. I tried DataSource.fetchData() but it says. "Operation Type fetch is not supported for this datasource". Please suggest how to achieve it?Tags: None
Leave a comment: