Reputation: 61
I am currently in the process of implementing state management for a web application that we have developed using ExtJS4.
For example, in Ext.application, I wrote:
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
Ext.Component.prototype.stateful = false;
On whichever control should maintain its state, we made the stateful
property of that control true
. In the below example, the stateful property of the combobox is true and working fine (these states will be used for the subsequent logged-in user):
{
xtype: 'combo'
stateful: true,
stateId: 'myid'
}
Now I would like to know if there is a way to maintain state on the same machine based on the user logged in. For example, when user1 logs in and logs out the value selected in a combobox is 10, and when user2 logs in and logs out the value selected in the combobox is 20.
I would like to maintain the state in such a way that when user1 is re-logged in, the combo box should show 10 and for user2, the combo box should show 20. Is it possible to maintain state on a per-user basis, not for the whole application (machine basis)?
Thanks & Regards, Mani Kumar Y
Upvotes: 1
Views: 491
Reputation: 13390
One option would be to adjust the stateId
based on the current user, such as stateId: username + '-myid'
. That way when "user1" is logged in, the stateId is user1-myid
, and when user2 is logged in, the stateId is user2-myid
. In that way, the states can be stored and loaded separately, depending on the current user.
Upvotes: 4