Giter VIP home page Giter VIP logo

Comments (16)

gabrielhpugliese avatar gabrielhpugliese commented on July 24, 2024

Hmm just read the source and you search on all fields that are on mongo. So, virtual columns can't be filtered, right?

from reactive-table.

aslagle avatar aslagle commented on July 24, 2024

That's correct, I made sorting use the virtual columns but forgot do the same for filtering. It shouldn't be too hard though. Thanks for noticing this.

from reactive-table.

gabrielhpugliese avatar gabrielhpugliese commented on July 24, 2024

I've been thinking on a solution and I probably it's easier doing a transform or using a package like https://github.com/dburles/meteor-collection-helpers instead creating the virtual columns in this package. What do you think?

from reactive-table.

aslagle avatar aslagle commented on July 24, 2024

Interesting, I hadn't seen that package. It looks like it could be useful but I don't see how it would help with filtering specifically. How are you thinking it would work?

from reactive-table.

gabrielhpugliese avatar gabrielhpugliese commented on July 24, 2024

It's working for me now with collection-helpers with dburles help: dburles/meteor-collection-helpers#5 (comment)
But sorting the column does not work =/

I do not need the fn to create the virtual column anymore :)

from reactive-table.

aslagle avatar aslagle commented on July 24, 2024

You'd need to change the code in sortedRows to fix the sorting, but it's not obvious how to do it. I'm using the presence of fn to decide how to sort, and that happens before getting the data so it wouldn't be possible to check for functions at that point.

I'm not sure but I think it might be easier to just implement filtering on virtual columns.

from reactive-table.

gabrielhpugliese avatar gabrielhpugliese commented on July 24, 2024

The reason I picked collection-helpers is because I didn't have to change your filter query at all. When you do collection.find(filterQuery) it's like the virtual column exists in the doc, but it actually does not, it's emulated it with the package transformation.

I think it was the clearest solution.

from reactive-table.

aslagle avatar aslagle commented on July 24, 2024

That is nice :)

So collection-helpers works in the filter query but not the sort query? I wonder how hard it would be to modify collection-helpers so the transforms would work with sorting...

from reactive-table.

gabrielhpugliese avatar gabrielhpugliese commented on July 24, 2024

I haven't seen the sorting code yet, but I will soon :)

from reactive-table.

kmligue avatar kmligue commented on July 24, 2024

hi guys,
@gabrielhpugliese i did what you did here dburles/meteor-collection-helpers#5 (comment) but still i cant figure this out...i still cant filter on virtual columns.. how did you make this work?

from reactive-table.

gabrielhpugliese avatar gabrielhpugliese commented on July 24, 2024

That was a long time ago. Idk if it works with the current version, but
that's the code:
https://github.com/gabrielhpugliese/reactive-table/blob/076e8e2a3ef7f1900e8dbb1e289ee875b072230d/lib/reactive_table.js#L142-L158

If you want to try the whole thing togheter, it's the filter branch :)

Gabriel Pugliese
CodersTV.com
@CodersTV

On Wed, Jul 30, 2014 at 11:11 PM, kelvin martin ligue <
[email protected]> wrote:

hi guys,
@gabrielhpugliese https://github.com/gabrielhpugliese i did what you
did here dburles/meteor-collection-helpers#5
dburles/meteor-collection-helpers#5 (comment)
but still i cant figure this out...i still cant filter on virtual columns..
how did you make this work?


Reply to this email directly or view it on GitHub
#44 (comment)
.

from reactive-table.

tagrudev avatar tagrudev commented on July 24, 2024

@gabrielhpugliese @aslagle it's not in the filter branch anymore I am trying to search on a virtual field that's connected with collection-helpers, or am I doing something wrong ?

        {
          key: 'userID'
          label: 'user'
          fn: (value, object) ->
            # here the getFullName is a collection helper on current collection
            # sorting works fine / filtering doesn't
            return object.getFullname()
        }

This is taken from documentation -

By default, fields that use fn will be sorted by the result of this function. If you want to sort by the field's original value instead (for example, if you are making a date human-readable), set sortByValue to true on the field object.

Sorting is ok, what about filtering ?

from reactive-table.

gabrielhpugliese avatar gabrielhpugliese commented on July 24, 2024

@tagrudev I've meant it's in filter branch of my fork: https://github.com/gabrielhpugliese/reactive-table/tree/filter

from reactive-table.

tagrudev avatar tagrudev commented on July 24, 2024

@gabrielhpugliese hmm had some problems running that with meteor 1.0 but after I did it is not filtering by the virtual field :) either

from reactive-table.

MichelFloyd avatar MichelFloyd commented on July 24, 2024

Any ETA on when filtering will work on fn fields?

from reactive-table.

graemian avatar graemian commented on July 24, 2024

I worked around not being able to filter virtual columns by using a client-side table filter library called List.js (https://listjs.com)

from reactive-table.

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.