Data Refresh when using proxy

Hi,

I linked up a few components List -> DataCollection -> Proxy to enable offline mode.
I have scenarios to refresh the data by calling the server url.

How can I achieve that? I tried different method like refreshing DataCollection or the list, with no luck, eg.

                               subsChannelStore.load(baseUrl + "/mobile/channels/subscribed",
			 
				function () {
					subsChannelStore.refresh();

$$(“subsChannelList”).refresh();
});

my initialization is below:

		var subsChannelSource = new dhx.proxy({
			  url: baseUrl + "/mobile/channels/subscribed",
			  storage: dhx.storage.local
			   
		});
		 
		var subsChannelStore =  new dhx.DataCollection({
				datatype:"json",
				url:subsChannelSource,
			}); 

Many Thanks!

Hi,
does any error occur?
It doesn’t load data into DataCollection, isn’t it?
Please, describe problem more in details.

Hi,

The initial data loading to local storage, data collection and list are perfectly fine. But now I want to refresh the data with new data from server. How can I do that?

Thanks

Hi,
when load method will be called the next time and server will be available then actual data will be loaded into datastore and added into local storage.
So the correct scenario is:
-datastore initialized
-data from server side is loaded via proxy
-data is added into local storage
-data is added into datastore
Data refreshes local storage each time when it’s loaded.
When data from server is not available then proxy restores last dataset from local storage.

Does it work any other way?

No doubt you’re right. My question is how can I trigger data reload from server? I tried the following, did not work.


subsChannelStore.load(baseUrl + “/mobile/channels/subscribed”,

function () {
subsChannelStore.refresh();
$$(“subsChannelList”).refresh();
});


try to use

subsChannelStore.clearAll();
subsChannelStore.load(subsChannelSource);

Thanks! Rendering works now… but when submitting the form, it gives error at:

var formData = $$(‘channelConfig’).getValues();

–> Cannot read property ‘childNodes’ of null

Below is the elements I retrieved from server before displaying the form:

{
id:“channelConfig”,
view:“form”,
style:“width:100%;height:100%;”,
scroll:“y”,
css:“basicBG account”,
elements:[{view:“toggle”, label:“Subscription”, id:“subscription” ,click:“submitConfig()”,labelPosition:“left”, labelWidth:100, options:[{value:“1”, label:“On”},
{value:“0”, label:“Off”}]},
],
rules:{}
}

sorry wrong reply i ll try your recomendation…

COOL! Yes It works. Many thanks for your help. DHTLX rocks!