meteor-tabular icon indicating copy to clipboard operation
meteor-tabular copied to clipboard

Support searching on joined data

Open manusharma1 opened this issue 9 years ago • 12 comments

I am using this package to render data from one collection, I have also tried collection helpers, but failed to join 2 collections, Can you give some simple example which shows how to join and display the data table using the 2 collections.

Thanks and Regards, Manu

manusharma1 avatar Sep 22 '15 10:09 manusharma1

I'm also interested in this, thanks

gibex avatar Oct 07 '15 18:10 gibex

Hi Gabriel,

Actually I have managed to achieve it using these packages :

reywood:publish-composite dburles:collection-helpers

Please refer : https://github.com/aldeed/meteor-tabular#using-a-custom-publish-function

But the issue that I a facing right now that while searching the records from joined collection are not working correctly in table search.

You can try this and let me know if this works for you.

Thanks, Manu

manusharma1 avatar Oct 07 '15 19:10 manusharma1

Sorry for the inconvenience , @manusharma1 can you help me with my problem? https://github.com/aldeed/meteor-tabular/issues/218

fipke avatar Oct 13 '15 22:10 fipke

Hi Djeimi, Have a look into my suggestion here:

https://github.com/aldeed/meteor-tabular/issues/218#issuecomment-147968699

Hope it will help you, Please let me know if you are able to solve this at your end,

Thanks, Manu

manusharma1 avatar Oct 14 '15 08:10 manusharma1

Yes, searching or sorting on joined data isn't currently possible. I am thinking about ways that simple joins might be supported for search.

aldeed avatar Oct 25 '15 13:10 aldeed

@aldeed basically, if you use publishComposite or anything similar, anything in the child cursor isn't searched over, correct?

dfischer avatar Jan 26 '16 23:01 dfischer

Hi @aldeed

Do we have some solution to this issue now?

Thanks and Best Regards, Manu

manusharma1 avatar Jul 17 '16 09:07 manusharma1

I am also interested in this.

Denormalization would be a solution, but we it adds a lot complexity... plus I find for denormalizing data there is NO package available that makes it easy.... it there only was then we could easily implement a highly searchable datatable with tabular.

This is my denormalization package suggestion: https://forums.meteor.com/t/who-would-be-interested-in-a-denormalization-package-for-simpleschema-collection-2/27201

thebarty avatar Jul 29 '16 09:07 thebarty

Hi @aldeed ,

I think we need to have some solution to resolve this issue as we are unable to use this package in many cases, search is important aspect of datatable and we need to have this working properly in case we are using joins.

Please try to have some solution soon.

Thanks and Best Regards, Manu

manusharma1 avatar Aug 02 '16 06:08 manusharma1

Hi guys,

just letting you know that I have created a package as a solution for this problem. It's in early beta and I am looking for feedback. Try it out at https://atmospherejs.com/thebarty/denormalized-views

thebarty avatar Aug 02 '16 16:08 thebarty

Why wouldn't the DataTables render function work for sorting and filtering like demonstrated below? It works for properly displaying the transformed data, but when I try to sort or filter, it is not behaving as expected. Firstly, when filtering, the value passed in "type" to the render function is "type" rather than "filter". Any of the "transformed" strings are not returned. Sorting appears to sort on the user_id rather than on the transformed string.

registrationTable.registrationsList = new Tabular.Table({
    name: 'registrationsList',
    collection: Registrations,
    responsive: true,
    autoWidth: false,
    columns: [
        {
            title: 'ID',
            data: '_id'
        },{
            title: 'Firstname',
            data: 'user_id',
            render: function(data, type){
                const user = Meteor.users.findOne(data, {fields: {"profile.firstName": 1}});
                return user.profile.firstName;
                }
            }
        },{
            title: 'Lastname',
            data: 'user_id',
            render: function(data, type){
                const user = Meteor.users.findOne(data, {fields: {"profile.lastName": 1}});
                return user.profile.lastName;
            }
        }
    ]
});

cormip avatar Mar 31 '17 16:03 cormip

Just a quick note here which might help someone else.

I've encountered the same problem when trying to search through a collection helper column.

However this collection helper is a simple join of two scheme fields as mentioned in the example. My small workaround has been to include the two columns separately while hiding them and search has been working for me again.

  columns: [
    {
      data: 'firstName'
      visible: false
    }
    {
      data: 'lastName'
      visible: false
    ...

slowdownitsfine avatar Sep 04 '17 09:09 slowdownitsfine