You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Based on the documentation, if you want to enable the select feature through the URL query (localhost?select=...), you have to ensure doing two things: First you must add the select property into the paginate() function call:
paginate(query,repo,{sortableColumns: / ** /,select: /* this needs to be set*/,// 👈})
Second
You need to ensure that in the select option, you're selecting the primary key, for example id:
paginate(query,repo,{sortableColumns: / ** /,select: ["id"👈,/* and optionally any other column */],})
My suggestion is, instead of making it that way, let's make the library itself add the primary key internally, because without that, if someone requests:
localhost?select=username
It's not going to work and it will return every other column, which makes someone think that there is a bug.
My suggestion is that the library should handle it internally somehow like this:
const repoPrimaryKey = /* the logic to get the repository primary key */
const selectedColumns = new Set()
if(select !== undefined && Array.isArray(select)) {
selectedColumns.forEach(columnName = selectedColumns.add(columnName))
selectedColumns.add(repoPrimaryKey)
}
const isSelectEnabled = !!selectedColumns.length
// ... rest
The text was updated successfully, but these errors were encountered:
happy to merge if you find a solution. as far as I remember the mandatory PK + client select being a subset of a mandatory server side set, were more like cheap fixes while we struggled to make a cleaner version work.
Based on the documentation, if you want to enable the
select
feature through the URL query(localhost?select=...)
, you have to ensure doing two things:First you must add the
select
property into thepaginate()
function call:Second
You need to ensure that in the
select
option, you're selecting the primary key, for exampleid
:My suggestion is, instead of making it that way, let's make the library itself add the primary key internally, because without that, if someone requests:
It's not going to work and it will return every other column, which makes someone think that there is a bug.
My suggestion is that the library should handle it internally somehow like this:
The text was updated successfully, but these errors were encountered: