0
votes

I know this subject has been discussed before but still have problem with refresh my list with refresh button after update the StoreList...

Here is my handler:

function clac_distance() {

for (var i=0;i<mydata.length;i++) 
{
    //alert((coor[1].lat-lat)*(Math.PI/180));        
    var R = 6371; // km

    var dLat = (coor[i].lat-lat)*(Math.PI/180);
    var dLon = (coor[i].lng-lng)*(Math.PI/180);

    var lat1 = lat*(Math.PI/180);
    var lat2 = coor[i].lat*(Math.PI/180);

    var a = Math.sin(dLat/2) * Math.sin(dLat/2) +
    Math.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2); 

    var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); 

    mydata[i].distance = (R * c).toFixed(2);


    //alert(mydata[i].distance);
}
    Toolbar.views.listPanel.update();
    Toolbar.views.listPanel.bindStore(ListStore);

}

1

1 Answers

2
votes

Ext.List listens to the datachanged event of the store it binds to, which means that the list component will update itself according to change in the store automatically. So the right approach is to change the model instance in the store properly:

ListStore.getById(id).set(key, value);

And good things will happen :)