Comments (16)
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.
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.
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.
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.
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.
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.
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.
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.
I haven't seen the sorting code yet, but I will soon :)
from reactive-table.
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.
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.
@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.
@tagrudev I've meant it's in filter
branch of my fork: https://github.com/gabrielhpugliese/reactive-table/tree/filter
from reactive-table.
@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.
Any ETA on when filtering will work on fn fields?
from reactive-table.
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)
- Is there any way to publish distinct rows and pass parameters in publish function? HOT 1
- $or and $and operators in custom Filters HOT 2
- how to set row height ? HOT 1
- injecting spacebar output into a row cell ? HOT 1
- Row numbering Excel-style HOT 2
- checkbox states is lost during navigation HOT 3
- show loader until data is ready for client HOT 3
- Client-side change page number through custom button HOT 3
- Table is not updated when data is $unset (context.server) HOT 1
- Compare two columns data in custom filter HOT 3
- Using _ properly on server HOT 1
- There are multiple templates named 'leaderboard' HOT 8
- `noDataTmpl` changes the DOM structure of the passed-in template HOT 1
- Table only updates when I update the fields from the first document HOT 1
- reactiveTable error: fields option is required with server-side publications HOT 1
- Error: Must use an ordered observe with skip or limit HOT 1
- Support for Bootstrap 4
- Date custom filter on reactive table collection not working HOT 2
- ReactiveTable.publish not working HOT 1
- getting ids of the whole published collection HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reactive-table.