View Full Version : Does clearOnPageLoad not work with default data?

6 Feb 2012, 1:31 AM
Hi guys,

I got a list which gets its data from a jsonp proxy. For example I get 3 items. Item1, Item2 and Item3.
What I want is that by default a fourth item exists which is named "Please select". Because I don't want to change the webservice, I thought, that I put the 4th item into the data-property and set ClearOnPageLoad to false. But that does not work. The item gets removed when the data comes in... Here is my config:

Ext.define('IP.store.base.TestStore', { extend: 'Ext.data.Store',
requires: [

config: {
autoLoad: true,
clearOnPageLoad: false,
data: [
id: 0,
name: 'Please select'
model: 'IP.model.TestModel',
storeId: 'TestStore',
proxy: {
type: 'jsonp',
url: 'http://localhost/GetData',
reader: {
type: 'json',
idProperty: 'id',
root: 'data'

The ids of item1-3 got the values 1, 2 and 3.

Any hints, why the default-item get removed?
Thanks :)

6 Feb 2012, 2:51 AM
Ah. From the docs: "True to empty the store when loading another page via loadPage (http://docs.sencha.com/touch/2-0/#!/api/Ext.data.Store-method-loadPage), nextPage (http://docs.sencha.com/touch/2-0/#!/api/Ext.data.Store-method-nextPage) or previousPage (http://docs.sencha.com/touch/2-0/#!/api/Ext.data.Store-method-previousPage) (defaults to true)." So my new question is: how do I load data from the proxy without deleting the existing data?

6 Feb 2012, 12:22 PM
I dont think your case can work out of the box. You could try this
1. Set autoLoad = false
2. You will need to add custom code in your store impl class to load data via store.add which appends the data