PDA

View Full Version : Store.loadData(..., false) doesn't clear the store



da_b0uncer
8 Aug 2013, 1:17 AM
I'm trying to create a grid in a tooltip, like in the rich-tips chart-example.

But my grid doesn't drop the data when loading new, so it get's bigger and bigger.



var renderer;
var oTips = Ext.isArray( oSeries.tooltip )? oSeries.tooltip : [oSeries.tooltip];
var aoTips = [];


var oTipStore = Ext.create( 'Ext.data.JsonStore', {
fields: ['name', 'data'],
data : []
} );


var oTipGrid = Ext.create( 'Ext.grid.Panel', {
store : oTipStore,
width : 300,
hideHeaders: true,
columns : [
{
flex : 1.5,
text : 'name',
dataIndex: 'name'
},
{
flex : 1,
text : 'data',
dataIndex: 'data'
}
]
} );


renderer = function( oRecord ) {
var strValue;
var i = 0, nFields = oTips.length;


for( ; i < nFields; ++i )
{
strValue = oRecord.get( oTips[i].field );


if( typeof strValue === 'number' )
{
strValue = Ext.util.Format.number( oRecord.get( oTips[i].field ), '0,000' );
}


aoTips.push( {name: oTips[i].field, data: strValue} );
}


oTipGrid.store.loadData( aoTips, false );
};


delete oSeries.tooltip;


oSeries.tips = {
trackMouse: true,
items : [oTipGrid],
renderer : renderer
};

da_b0uncer
8 Aug 2013, 1:21 AM
lol, Ok got it.
I closed the renderer function over the aoTips array, so it kept the tips from every rendering... :((