And one more thing. If I do like this: ‘query’ => Jobs::find()->orderBy(‘active DESC’). Then the default order is correct without ‘sort’ parameter. But in that case GridView sorting doesn’t work by ‘Active’ column. But as I understand this is not a bug, and the $query sorting has higher priority. Or not?
softark, could you explain what ‘attributes’ are for? With your suggestion the default sorting really applies, but the client-side sorting gets disabled (column headers become not clickable and manual inserting of sort GET parameters doesn’t make any effect).
The things are getting even more strange. I brought the project to home and the same code behaves in a differect way.
IIRC, "attributes" could be null when you would be satisfied with the default construction of the sort object. But you need to list all the attributes explicitly when you want to configure "defaultOrder".
I found what was the problem. As it often happens, the problem was hidden in a place where I didn’t search for it
Attributes turned out to be case-sensitive. I usually name DB columns in lower case, but this time some columns’ names were in upper case. So everything I need to do is replace ‘active’ with ‘ACTIVE’