jbox-web / ajax-datatables-rails

A wrapper around DataTable's ajax methods that allow synchronization with server-side pagination in a Rails app
MIT License
585 stars 228 forks source link

A way to search without filtering #339

Closed chakflying closed 9 months ago

chakflying commented 4 years ago

So I have a Group model, which has many-to-many-through with UserGroup1 and UserGroup2, and are displayed in the same row like this: Screenshot_2019-09-20 Manage Groups - PolyU FYP Management However, if I search for one of the users in a Group, the other users in that group disappears. Here I searched for tom: Screenshot_2019-09-20 Manage Groups - PolyU FYP Management(1)

Here is the view_columns def:

@view_columns ||= {
      number: { source: 'Group.number', cond: :eq },
      usergroup1: { source: 'UserGroup1.netID' },
      usergroup2: { source: 'UserGroup2.netID' },
      sync_id: { source: 'Group.sync_id', cond: :eq },
      dt_action: { searchable: false }
    }

and here is the get raw records:

Group.all.includes(usergroup1: :department, usergroup2: :department).references(:usergroup1, :usergroup2)

Just wondering if there is a way I can search for my Groups without it filtering out the individual users in that group?