octobercms / october

Self-hosted CMS platform based on the Laravel PHP Framework.
https://octobercms.com/
Other
11.03k stars 2.21k forks source link

Search in list in Settings menu not working for model using SimpleTree trait #4945

Closed chrisvidal closed 4 years ago

chrisvidal commented 4 years ago

Description:

Steps To Reproduce:

I have the following setup:

no trace here, as it should be.

public function listExtendQuery($query)
{
    trace_log($query->toSql());
}
chrisvidal commented 4 years ago

and the sorting setup in `config_list.yaml' is not working as well.

bennothommo commented 4 years ago

@chrisvidal Would you please be able to provide the config you are using for the list?

chrisvidal commented 4 years ago

the config_list.yaml

list: $/voilaah/astar/models/capability/columns.yaml
modelClass: Voilaah\Astar\Models\Capability
title: Capabilities
noRecordsMessage: 'backend::lang.list.no_records'
showSetup: true
showCheckboxes: true
recordsPerPage: 20
toolbar:
    buttons: list_toolbar
    search:
        prompt: 'backend::lang.list.search_prompt'
recordUrl: 'voilaah/astar/capabilities/update/:id'
defaultSort:
    column: name
    direction: asc
showTree: true
chrisvidal commented 4 years ago

the search is working as expected, I forgot to set the searchable: true in the columns.yaml, my apologies

Only the sorting is not working.

bennothommo commented 4 years ago

@chrisvidal Sorting is not applied when the list is in a tree view (ie. showTree is true). If you require sorting, you cannot use the tree view.

chrisvidal commented 4 years ago

I see ~ is it the same behavior with NesteTree? so what is the sorting applied?

bennothommo commented 4 years ago

@chrisvidal Yes, the same behaviour applies with the NestedTree trait as well. I believe Simple Trees are just sorted by parent_id and ID fields, whereas Nested Tree uses the left/right values to determine order.

chrisvidal commented 4 years ago

alright then. closing. the search is working and that is all that matters to me here thanks @bennothommo