johnny1991

johnny1991

xxxxxxxxxxxxxxxxxxxxx

  • 财富值3285
  • 威望值580
  • 总积分9895

个人信息

  • 提出了问题
    安装doc api出问题了
  • view 有这个widget方法吗?

  • 2017-04-18 已签到
    连续签到4天,获得了20个金钱
  • 收藏了扩展
    Yii2-ueditor-widget
  • 收藏了扩展
    Yii2 使用 datetimepicker 插件
  • 回复了 的评论

    除了composer安装,直接下载的怎么配置?

    下载好了之后,放在vendor文件下面,然后配置一下yiisoft下面的exetension.php里面的配置就可以的,难点在于按照yii框架的类自动加载机制配置好别名

  • 收藏了扩展
    markdown编辑器
  • 回复了 的回答

    参照yii\grid\GridView的这两个方法

    public function renderTableBody()
        {
            $models = array_values($this->dataProvider->getModels());
            $keys = $this->dataProvider->getKeys();
            $rows = [];
            foreach ($models as $index => $model) {
                $key = $keys[$index];
                if ($this->beforeRow !== null) {
                    $row = call_user_func($this->beforeRow, $model, $key, $index, $this);
                    if (!empty($row)) {
                        $rows[] = $row;
                    }
                }
    
                $rows[] = $this->renderTableRow($model, $key, $index);
    
                if ($this->afterRow !== null) {
                    $row = call_user_func($this->afterRow, $model, $key, $index, $this);
                    if (!empty($row)) {
                        $rows[] = $row;
                    }
                }
            }
    
            if (empty($rows)) {
                $colspan = count($this->columns);
    
                return "<tbody>\n<tr><td colspan=\"$colspan\">" . $this->renderEmpty() . "</td></tr>\n</tbody>";
            } else {
                return "<tbody>\n" . implode("\n", $rows) . "\n</tbody>";
            }
        }
    
    public function renderTableRow($model, $key, $index)
        {
            $cells = [];
            /* @var $column Column */
            foreach ($this->columns as $column) {
                $cells[] = $column->renderDataCell($model, $key, $index);
            }
            if ($this->rowOptions instanceof Closure) {
                $options = call_user_func($this->rowOptions, $model, $key, $index, $this);
            } else {
                $options = $this->rowOptions;
            }
            $options['data-key'] = is_array($key) ? json_encode($key) : (string) $key;
    
            return Html::tag('tr', implode('', $cells), $options);
        }
    

    看源码啊

  • 回复了 的回答

    参照yii\grid\GridView的这两个方法

    public function renderTableBody()
        {
            $models = array_values($this->dataProvider->getModels());
            $keys = $this->dataProvider->getKeys();
            $rows = [];
            foreach ($models as $index => $model) {
                $key = $keys[$index];
                if ($this->beforeRow !== null) {
                    $row = call_user_func($this->beforeRow, $model, $key, $index, $this);
                    if (!empty($row)) {
                        $rows[] = $row;
                    }
                }
    
                $rows[] = $this->renderTableRow($model, $key, $index);
    
                if ($this->afterRow !== null) {
                    $row = call_user_func($this->afterRow, $model, $key, $index, $this);
                    if (!empty($row)) {
                        $rows[] = $row;
                    }
                }
            }
    
            if (empty($rows)) {
                $colspan = count($this->columns);
    
                return "<tbody>\n<tr><td colspan=\"$colspan\">" . $this->renderEmpty() . "</td></tr>\n</tbody>";
            } else {
                return "<tbody>\n" . implode("\n", $rows) . "\n</tbody>";
            }
        }
    
    public function renderTableRow($model, $key, $index)
        {
            $cells = [];
            /* @var $column Column */
            foreach ($this->columns as $column) {
                $cells[] = $column->renderDataCell($model, $key, $index);
            }
            if ($this->rowOptions instanceof Closure) {
                $options = call_user_func($this->rowOptions, $model, $key, $index, $this);
            } else {
                $options = $this->rowOptions;
            }
            $options['data-key'] = is_array($key) ? json_encode($key) : (string) $key;
    
            return Html::tag('tr', implode('', $cells), $options);
        }
    

    具体通过这个来设置的
    $keys = $this->dataProvider->getKeys();

  • 回复了 的回答

    参照yii\grid\GridView的这两个方法

    public function renderTableBody()
        {
            $models = array_values($this->dataProvider->getModels());
            $keys = $this->dataProvider->getKeys();
            $rows = [];
            foreach ($models as $index => $model) {
                $key = $keys[$index];
                if ($this->beforeRow !== null) {
                    $row = call_user_func($this->beforeRow, $model, $key, $index, $this);
                    if (!empty($row)) {
                        $rows[] = $row;
                    }
                }
    
                $rows[] = $this->renderTableRow($model, $key, $index);
    
                if ($this->afterRow !== null) {
                    $row = call_user_func($this->afterRow, $model, $key, $index, $this);
                    if (!empty($row)) {
                        $rows[] = $row;
                    }
                }
            }
    
            if (empty($rows)) {
                $colspan = count($this->columns);
    
                return "<tbody>\n<tr><td colspan=\"$colspan\">" . $this->renderEmpty() . "</td></tr>\n</tbody>";
            } else {
                return "<tbody>\n" . implode("\n", $rows) . "\n</tbody>";
            }
        }
    
    public function renderTableRow($model, $key, $index)
        {
            $cells = [];
            /* @var $column Column */
            foreach ($this->columns as $column) {
                $cells[] = $column->renderDataCell($model, $key, $index);
            }
            if ($this->rowOptions instanceof Closure) {
                $options = call_user_func($this->rowOptions, $model, $key, $index, $this);
            } else {
                $options = $this->rowOptions;
            }
            $options['data-key'] = is_array($key) ? json_encode($key) : (string) $key;
    
            return Html::tag('tr', implode('', $cells), $options);
        }
    

    ‘data-key’从源码看起来,是单独设置的,
    $options['data-key'] = is_array($key) ? json_encode($key) : (string) $key;

副总裁 等级规则
9895/10000
资料完整度
60/100
用户活跃度
0/100

Ta的关注

19

Ta的粉丝

26

Ta的访客

81