Ext.define("Ext.ux.buffer.Store", {
	
	extend: "Ext.data.Store",

	config: {
		idProperty: null
	},
	
	constructor: function() {
		
		var i_self = this;
		i_self.callParent(arguments);
		var s_idProperty = i_self.getIdProperty();

		if (s_idProperty) {

			var i_model = i_self.getModel();
			var i_proto = i_model.prototype;

			var a_fields = i_proto.getFields();

			var s_oldId = i_proto.getIdProperty();

			if (s_oldId !== s_idProperty) {

				var a_result = Ext.Array.filter(a_fields, function(i_field) {
					return i_field.name !== s_oldId;
				});

				i_model.idProperty = i_proto.idProperty = s_idProperty;

				i_model.replaceFields(a_result, true);
				
			}
		}
	},
});
