阿江

阿江

这家伙有点懒,还没写个性签名!

  • 财富值

    13581

  • 威望值

    110

  • 总积分

    15861

个人信息

  • 你这实际上上向Gridview传参数的问题:

    $this->params["page"]=$page;
    ......
    'update' => function ($url, $model, $key) {
        $newpage=$this->params["page"]
    }
    
  • 2018-11-15 已签到
    连续签到18天,获得了20个金钱
  • 整出来了,需要确切指定第二排序字段id的排序方式,OK

    'sort'=>[
    	'attributes'=>[
    		'gdp'=>[
    			'asc'=>['gdp'=>SORT_ASC,'id'=>SORT_ASC],
    			'desc'=>['gdp'=>SORT_DESC,'id'=>SORT_DESC],
    			'default'=>SORT_DESC,
    		],
         'year',
         'acreage',        
         ......
    

    感谢 的解答,谢谢!

  • 2018-11-14 已签到
    连续签到17天,获得了20个金钱
  • 回复了 的说说
    团队开发用什么代码管理工具比较好呀
    git
  • 回复了 的回答
    <?php
    public function search($params)
    {
        $tableName = static::tableName();
        $query = static::find()->select([
            $tableName . '.id',
            $tableName . '.cityname',
            $tableName . '.parentid', 
            $tableName . '.population',
            $tableName . '.gdp', 
            $tableName . '.year', 
            $tableName . '.acreage', 
            $tableName . '.popu_per_sqkm', 
            $tableName . '.gdp_per_man', 
            $tableName . '.abbrname',])
            ->with('parent');
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'pagination' => [
                'pageSize' =>20,
            ],
           'sort'=>[
                'attributes'=>[
                    $tableName . .'id',
                    $tableName . '.parentid',
                    $tableName . '.cityname',
                    $tableName . '.population',
                    $tableName . '.gdp',
                    $tableName . '.year',
                    $tableName . '.acreage',
                    $tableName . '.popu_per_sqkm',
                    $tableName . '.gdp_per_man',
                    $tableName . '.abbrname',
                ],
                'defaultOrder'=>[$tableName . '.id'=>SORT_ASC],
            ],
        ]);
        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }
        $query->andFilterWhere(['=', $tableName . '.parentid', $this->parentid])
            ->andFilterWhere(['like', $tableName . '.cityname', $this->cityname]);
        return $dataProvider;
    }
    ?>
    

    带上表名试试

    SELECT `city`.`id`, `city`.`cityname`, `city`.`parentid`, `city`.`population`, `city`.`gdp`, `city`.`year`, `city`.`acreage`, `city`.`popu_per_sqkm`, `city`.`gdp_per_man`, `city`.`abbrname` FROM `city` WHERE `city`.`parentid` = '460000'
    
  • 回复了 的说说
    oschina开源软件,给fecshop投投票:https://www.oschina.net/project/top_cn_2018 进入后ctrl + F , 搜索fecshop , 就可以看到
    投了
  • 赞了说说
    oschina开源软件,给fecshop投投票:https://www.oschina.net/project/top_cn_2018 进入后ctrl + F , 搜索fecshop , 就可以看到
  • 回复了 的回答
    <?php
    public function search($params)
    {
        $tableName = static::tableName();
        $query = static::find()->select([
            $tableName . '.id',
            $tableName . '.cityname',
            $tableName . '.parentid', 
            $tableName . '.population',
            $tableName . '.gdp', 
            $tableName . '.year', 
            $tableName . '.acreage', 
            $tableName . '.popu_per_sqkm', 
            $tableName . '.gdp_per_man', 
            $tableName . '.abbrname',])
            ->with('parent');
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'pagination' => [
                'pageSize' =>20,
            ],
           'sort'=>[
                'attributes'=>[
                    $tableName . .'id',
                    $tableName . '.parentid',
                    $tableName . '.cityname',
                    $tableName . '.population',
                    $tableName . '.gdp',
                    $tableName . '.year',
                    $tableName . '.acreage',
                    $tableName . '.popu_per_sqkm',
                    $tableName . '.gdp_per_man',
                    $tableName . '.abbrname',
                ],
                'defaultOrder'=>[$tableName . '.id'=>SORT_ASC],
            ],
        ]);
        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }
        $query->andFilterWhere(['=', $tableName . '.parentid', $this->parentid])
            ->andFilterWhere(['like', $tableName . '.cityname', $this->cityname]);
        return $dataProvider;
    }
    ?>
    

    带上表名试试

    兄弟,不管用啊!

  • 2018-11-13 已签到
    连续签到16天,获得了20个金钱
15861/20000
资料完整度
10/100
用户活跃度
40/100

Ta的关注

2

Ta的粉丝

83

Ta的访客

185