yii2重定向时如何在url中添加降序排序
How to add descending order sorting in the url in yii2 when redirecting
首先,我正在学习yii2
我想通过添加 "desc" "sort"(降序排序)重定向到特定的 URL
我有一个包含 4 列的网格视图。
我想通过在 URL 中默认添加排序来重定向。
我添加了 URL
return $this->redirect(array('city/index','UserCitySearch[citytype]' => 54));
我需要在上面的重定向中 descending
顺序中添加 sorting
of "added_time"
。
任何人都可以帮助我如何在重定向中添加此排序 url。
这取决于您用于排序的组件及其配置方式。
如果您使用具有默认值的标准 yii\data\Sort
,则需要设置的参数是 sort
,降序是通过在列名称前加上前缀 -
来完成的。
return $this->redirect(array(
'city/index',
'UserCitySearch[citytype]' => 54,
'sort' => '-added_time',
));
参数名称取决于 yii\data\Sort::$sortParam
属性.
首先,我正在学习yii2
我想通过添加 "desc" "sort"(降序排序)重定向到特定的 URL 我有一个包含 4 列的网格视图。
我想通过在 URL 中默认添加排序来重定向。
我添加了 URL
return $this->redirect(array('city/index','UserCitySearch[citytype]' => 54));
我需要在上面的重定向中 descending
顺序中添加 sorting
of "added_time"
。
任何人都可以帮助我如何在重定向中添加此排序 url。
这取决于您用于排序的组件及其配置方式。
如果您使用具有默认值的标准 yii\data\Sort
,则需要设置的参数是 sort
,降序是通过在列名称前加上前缀 -
来完成的。
return $this->redirect(array(
'city/index',
'UserCitySearch[citytype]' => 54,
'sort' => '-added_time',
));
参数名称取决于 yii\data\Sort::$sortParam
属性.