Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Sorting Array Issue

$
0
0

@Arunpkumar1991 wrote:

I am sorting array with function
sortArray(x){
if(x == 'Hour'){
this.temp_bitcoin = this.bitcoinData.sort((a: any, b: any) => {
return b['percent_change_1h'] - a['percent_change_1h'];
});
this.showSomeData(this.temp_bitcoin);

    }else if(x == 'Day'){
        this.temp_bitcoin=   this.bitcoinData.sort((a: any, b: any) => {
            return  b['percent_change_24h'] - a['percent_change_24h'];
        });
        this.showSomeData(this.temp_bitcoin)


    }else if(x == 'Week'){
        this.temp_bitcoin =   this.bitcoinData.sort((a: any, b: any) => {
            return  b['percent_change_7d'] - a['percent_change_7d'];
        });
        this.showSomeData(this.temp_bitcoin)

    }
    return this.temp_bitcoin;
}

now i want to show only 50 items in the array. But hte view is not updating the array as sorted . Like initially the array will be sorted hourly but after its week the array title will not change only its value updates

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>