Custom Aggregate Table
Hi. I'm having error on aggregate table on v4.
In v3, I can add the getTableRecordKey function and everything work just fine.
But in v4, even though I added this to resolve table record id, but it seems like the query builder still get the model id in the groupBy by the end.
Here is what i have on v4 custom table page:
and here is the page error it throws:
Can any body had any solution for this?
15 Replies
Does this work?
thanks for your reply. This did render the page just fine. But then, it destroy the purpose of the page. I want to make a report page by grouping by some column.
Isn't it grouped by
importer now?
Not sure when the ID is added. You could try disabling only_full_group_by from sql_mode.Only when I added
customs_data.id, the page runs.
But it doesn't grouped by importer only, which destroyed the purpose of the page.
I'm pretty sure the page worked just fine in V3 (similar query), but when upgrade to V4, it throws the error.having same problem here. in v3 it works totally fine. in v4 I get something like this
happening in my dashboard widget tables with group by
I think you can disable this behaviour by
->hasDefaultKeySort(false) on the table.so i apply it on every widget table in v4?
Probably everywhere where you use GROUP BY and use MySQLs
ONLY_FULL_GROUP_BYi see. ok will try and see if that fixes it
Strange that i got no errors in v3 tho
i just checked out ->hasDefaultKeySort()
It doesn't accept any argument, so i cannot pass
false into itAh, it's
->defaultKeySort(false)ah so in v3 it is false and in v4 it is true by default?
Actually just curious, what does it do and how is it different from ->defaultSort('id', 'desc')
I am not 100% sure, but I assume we add a default sort on the key of the model, so ordering is consistent. Maybe that wasn't the case in v3.
Probably no difference to
->defaultSort('id', 'desc'), just that it's applied automatically if you don't define any sortNo. The query always added "id" sort by the end. Even if I tried to default to a different column. For example, ->defaultSort('created_at') will always result in created_at asc and id asc in SQL output. I don't know why this behavior is enabled by default, but for this reason, every time I want to make something run smoother, I have to create both the columns I want to index, plus the id.
Yes, but I wrote
->defaultKeySort(false). Did you try that one?I will try that later. Sorry, I though you were discussing about adding
->defaultSort() will remove the 'id' sort by default.