Q:

Sencha Data View Store Clear

I have a store this store loading a nested json value. 
For Example image is here :

I listing main data first and sending store to data view. When click the record i want clear dataview records and show clicked record sub items.  When user clicked the back button i send "0" value to function and I want show the main items again.
But i could not remove data view store from dataview. 
if (grpID==='0')
{

Ext.getCmp('dvGroups').setStore(NewMobile.globals.products);

    Ext.getCmp('dvGroups').refresh();

}
else
{
    if( Ext.getCmp('dvGroups').getStore()!==undefined)
    {

           Ext.getCmp('dvGroups').setData(null);

           Ext.getCmp('dvGroups').setStore(null);

    }

   Ext.getCmp('dvGroups').setData(grpID.subItems);
   Ext.getCmp('dvGroups').refresh();

}

A:

Fixed with this :
    if (grpID==='0')
{

Ext.getCmp('dvGroups').setStore(NewMobile.globals.products);

    Ext.getCmp('dvGroups').refresh();

}
else
{
    if( Ext.getCmp('dvGroups').getStore()!==undefined)
    {

           var str = Ext.create('Ext.data.Store', {
              model: 'NewMobile.model.Products',
              data: grpID.subItems
                });

    }

Ext.getCmp('dvGroups').setStore(str);
   Ext.getCmp('dvGroups').refresh();

}

