View Full Version : "store" some temporary defined user data

31 Jan 2014, 2:41 PM
Whats the proper way to "store" some temporary defined user data for filtering/modifying user results during subseqent clicks? ...for example the user clicks in the menu to define some date (lats say 30 days)... now i want that all reports on the page that he "clicks" take this date into consideration (in reality this date is a parameter of a remote server calls)...? ...and is this really a best way to solve my described problem?

3 Feb 2014, 1:05 AM
Hello zenrast,
One way is, if you are using MVC, you might have a dedicated controller to the view on which the user is functioning. SO, save the data in configs or statics of the controller.
Second way is to store temp data in HTML5's localstorage (both key value pair saving and local database storing(SQLITE) ). It depends on the size of data to choose from both. This data persists even after browser refresh.

3 Feb 2014, 10:50 AM
Hi palakurthivishal, im using MVC. Can you please give and example of how to use "configs or statics" of controller for this? Im not sure how the logic behind those concepts work...

3 Feb 2014, 10:09 PM
Hello zenrast,

Ext.define('App.controller.YourController', {
extend : 'Ext.app.Controller',
config : { userDetails : null},
statics : { user : null},
init : function(){

method1 : function(){
// you can access the properties this way all over this controller scope
this.userDetails = { 'userName' : 'test1'}; // configs
this.self.user = {'userName' ; 'test2'}; // statics
method2 : function(){
// send the saved data
var data = JSON.stringify(this.userDetails); // var request = JSON.stringify(this.self.user);
Ext.Ajax(url, params : data, success : fn );

4 Feb 2014, 1:10 PM
Thanks palakurthivishal, what i didnt realize is that ExtJs is a statefull framework. So the variables are "remembered" between user actions. Thanks to pointing me to right direction :)

5 Feb 2014, 5:39 AM
no problem... =D>