Code Monkey home page Code Monkey logo

Comments (8)

VadimDez avatar VadimDez commented on May 20, 2024 2

i've released new version 2.0.0, please update.
I as well updated example for the new version:
https://stackblitz.com/edit/angular-nck6db?file=app%2Fapp.component.ts

In order to make it work change your code to:

this._danePgee2017Service.getPgee2017().subscribe((response) => {
  this.pgee2017 = orderPipe.transform(response, 'msc');
});

from ngx-order-pipe.

VadimDez avatar VadimDez commented on May 20, 2024

What version of ngx-order-pipe are you using?

from ngx-order-pipe.

Guru992 avatar Guru992 commented on May 20, 2024

1.2.1

from ngx-order-pipe.

VadimDez avatar VadimDez commented on May 20, 2024

I'm confused, why would you pass a service?

console.log(this.orderPipe.transform(this._danePgee2017Service, this.order));

If you comment this line out, does it show you the same error?

Take a look at the example project:
https://stackblitz.com/edit/angular-nck6db?file=app%2Fapp.component.ts

from ngx-order-pipe.

Guru992 avatar Guru992 commented on May 20, 2024

I change my appComponent to something closer to your example, but now i have an error: "Cannot read property 'slice' of undefined":

import { Component, OnInit } from '@angular/core';
import { Rider } from "../riders/rider";
import { Danepgee2017Service } from '../../danepgee2017.service';
import { OrderPipe } from 'ngx-order-pipe';

@Component({
  selector: 'gs-pgee2017-stats',
  templateUrl: './pgee2017-stats.component.html',
  styleUrls: ['./pgee2017-stats.component.less'],
})
export class Pgee2017StatsComponent {
pgee2017: Array<any>;
result: number[];
  constructor(private _danePgee2017Service: Danepgee2017Service,
    private orderPipe: OrderPipe) 
  {
this._danePgee2017Service.getPgee2017().subscribe(response => this.pgee2017 = response);
let copy = this.pgee2017.slice();
this.result = orderPipe.transform(copy, 'msc');
}

from ngx-order-pipe.

Guru992 avatar Guru992 commented on May 20, 2024

Great! Works good now. Thank you! I have one additional question: in 'msc" column I have numbers from 1 to 55 (this is place in classification) and string "ns" which means "unclassified". When I try to sort it, column goes crazy and I receive different order after every single click. Starting position is always the same, but not good, because after 32 I have: 34, 35, 36, 37, 38, 39, ns, ns, ..., ns, 33, 40, 41, 42, .... Is there any solution to sort it right or this is not possible to mix numbers and strings values?

from ngx-order-pipe.

VadimDez avatar VadimDez commented on May 20, 2024

Closing this for now, since your original issue is solved.

Could you show me how your data looks like and which field should be sorted?

from ngx-order-pipe.

Guru992 avatar Guru992 commented on May 20, 2024

Field "MSC" should be sorted.

"data":[{"_id":"5a89c61759db01b1e7f36479","MSC":4},{"_id":"5a89c61759db01b1e7f3647a","MSC":5},{"_id":"5a89c61759db01b1e7f3647b","MSC":6},{"_id":"5a89c61759db01b1e7f3647c","MSC":7},{"_id":"5a89c61759db01b1e7f3647d","MSC":8},{"_id":"5a89c61759db01b1e7f3647e","MSC":9},{"_id":"5a89c61759db01b1e7f3647f","MSC":10},{"_id":"5a89c61759db01b1e7f36480","MSC":11},{"_id":"5a89c61759db01b1e7f36481","MSC":12},{"_id":"5a89c61759db01b1e7f36482","MSC":13},{"_id":"5a89c61759db01b1e7f36483","MSC":14},{"_id":"5a89c61759db01b1e7f36484","MSC":15},{"_id":"5a89c61759db01b1e7f36485","MSC":16},{"_id":"5a89c61759db01b1e7f36486","MSC":17},{"_id":"5a89c61759db01b1e7f36487","MSC":18},{"_id":"5a89c61759db01b1e7f36488","MSC":19},{"_id":"5a89c61759db01b1e7f36489","MSC":20},{"_id":"5a89c61759db01b1e7f3648a","MSC":21},{"_id":"5a89c61759db01b1e7f3648b","MSC":1},{"_id":"5a89c61759db01b1e7f3648c","MSC":2},{"_id":"5a89c61759db01b1e7f3648d","MSC":3},{"_id":"5a89c61759db01b1e7f3648e","MSC":22},{"_id":"5a89c61759db01b1e7f3648f","MSC":23},{"_id":"5a89c61759db01b1e7f36490","MSC":24},{"_id":"5a89c61759db01b1e7f36491","MSC":25},{"_id":"5a89c61759db01b1e7f36492","MSC":26},{"_id":"5a89c61759db01b1e7f36493","MSC":30},{"_id":"5a89c61759db01b1e7f36494","MSC":31},{"_id":"5a89c61759db01b1e7f36495","MSC":32},{"_id":"5a89c61759db01b1e7f36496","MSC":33},{"_id":"5a89c61759db01b1e7f36497","MSC":34},{"_id":"5a89c61759db01b1e7f36498","MSC":35},{"_id":"5a89c61759db01b1e7f36499","MSC":36},{"_id":"5a89c61759db01b1e7f3649a","MSC":37},{"_id":"5a89c61759db01b1e7f3649b","MSC":38},{"_id":"5a89c61759db01b1e7f3649c","MSC":39},{"_id":"5a89c61759db01b1e7f3649d","MSC":40},{"_id":"5a89c61759db01b1e7f3649e","MSC":41},{"_id":"5a89c61759db01b1e7f3649f","MSC":42},{"_id":"5a89c61759db01b1e7f364a0","MSC":43},{"_id":"5a89c61759db01b1e7f364a1","MSC":44},{"_id":"5a89c61759db01b1e7f364a2","MSC":45},{"_id":"5a89c61759db01b1e7f364a3","MSC":46},{"_id":"5a89c61759db01b1e7f364a4","MSC":47},{"_id":"5a89c61759db01b1e7f364a5","MSC":27},{"_id":"5a89c61759db01b1e7f364a6","MSC":28},{"_id":"5a89c61759db01b1e7f364a7","MSC":29},{"_id":"5a89c61759db01b1e7f364a8","MSC":48},{"_id":"5a89c61759db01b1e7f364a9","MSC":49},{"_id":"5a89c61759db01b1e7f364aa","MSC":50},{"_id":"5a89c61759db01b1e7f364ab","MSC":51},{"_id":"5a89c61759db01b1e7f364ac","MSC":52},{"_id":"5a89c61759db01b1e7f364ad","MSC":55},{"_id":"5a89c61759db01b1e7f364ae","MSC":53},{"_id":"5a89c61759db01b1e7f364af","MSC":"ns"},{"_id":"5a89c61759db01b1e7f364b0","MSC":"ns"},{"_id":"5a89c61759db01b1e7f364b1","MSC":"ns"},{"_id":"5a89c61759db01b1e7f364b2","MSC":"ns"},{"_id":"5a89c61759db01b1e7f364b3","MSC":"ns"},{"_id":"5a89c61759db01b1e7f364b4","MSC":54},{"_id":"5a89c61759db01b1e7f364b5","MSC":"ns"},{"_id":"5a89c61759db01b1e7f364b6","MSC":"ns"},{"_id":"5a89c61759db01b1e7f364b7","MSC":"ns"},{"_id":"5a89c61759db01b1e7f364b8","MSC":"ns"},{"_id":"5a89c61759db01b1e7f364b9","MSC":"ns"},{"_id":"5a89c61759db01b1e7f364ba","MSC":"ns"},{"_id":"5a89c61759db01b1e7f364bb","MSC":"ns"},{"_id":"5a89c61759db01b1e7f364bc","MSC":"ns"},{"_id":"5a89c61759db01b1e7f364bd","MSC":"ns"},{"_id":"5a89c61759db01b1e7f364be","MSC":"ns"},{"_id":"5a89c61759db01b1e7f364bf","MSC":"ns"},{"_id":"5a89c61759db01b1e7f364c0","MSC":"ns"},{"_id":"5a89c61759db01b1e7f364c1","MSC":"ns"},{"_id":"5a89c61759db01b1e7f364c2","MSC":"ns"},{"_id":"5a89c61759db01b1e7f364c3","MSC":"ns"},{"_id":"5a89c61759db01b1e7f364c4","MSC":"ns"},{"_id":"5a89c61759db01b1e7f364c5","MSC":"ns"},{"_id":"5a89c61759db01b1e7f364c6","MSC":"ns"},{"_id":"5a89c61759db01b1e7f364c7","MSC":"ns"}]}

from ngx-order-pipe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.