Skip to content

Commit 2898774

Browse files
committed
Grid Action 宽度,固定设置
添加页面内容区域刷新事件和顶部刷新按钮
1 parent f0c1761 commit 2898774

File tree

21 files changed

+124
-24
lines changed

21 files changed

+124
-24
lines changed

docs/custom.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,12 @@ this.$bus.emit("tableSetLoading",true);
621621
this.$bus.emit("tableSetLoading",false);
622622
```
623623

624+
### 刷新内容区域
625+
626+
```php
627+
this.$bus.emit("pageReload");
628+
```
629+
624630

625631

626632
更多事件正在开发中......

docs/grid.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ $grid->selection();
138138
更多使用请查看 [Laravel 预加载](https://learnku.com/docs/laravel/6.x/eloquent-relationships/5177#eager-loading)
139139

140140
```php
141-
$grid->with(['roles:id,name', 'roles.permissions', 'roles.menus']);
141+
$grid->model()->with(['roles:id,name', 'roles.permissions', 'roles.menus']);
142142
```
143143

144144
### 默认排序
@@ -428,9 +428,9 @@ Table 的数据列
428428

429429
```php
430430
//基本使用
431-
$column = $grid->column('prop', 'label','column-key');
431+
$grid->column('prop', 'label','column-key');
432432
//属性设置
433-
$column = $grid->column('prop', 'label','column-key')->width("100");
433+
$grid->column('prop', 'label','column-key')->width("100");
434434
```
435435

436436
### 属性
@@ -585,16 +585,17 @@ $grid->column('name')->itemSuffix("折")
585585
586586
此功能必须满足以下几点才能正常使用,暂不支持分页,所以不建议展示大量的数据,后期会加入异步加载
587587

588-
定义一个 `hasMany`管理,名称固定为`children`,并预加载所有`children`,设置好排序
588+
定义一个 `hasMany`管理,名称为`children`,并预加载所有`children`,设置好排序
589589
```php
590590
public function children() {
591591
return $this->hasMany(get_class($this), 'parent_id' )->orderBy('order')->with( 'children' );
592592
}
593593
```
594594
以下代码开启树形展示模式
595595
```php
596-
$grid->tree();
597-
$grid->defaultExpandAll();//是否默认展开所有行
596+
$grid->model()->where('parent_id', 0);//设置查询条件
597+
$grid->tree();//启动树形表格
598+
$grid->defaultExpandAll();//默认展开所有行
598599
```
599600

600601

@@ -604,12 +605,12 @@ $grid->defaultExpandAll();//是否默认展开所有行
604605
要显示关联模型的值,使用`.`来获取关联模型的值,可以多级显示,最后一级为要显示的值
605606
#### 一对一
606607
```php
607-
$grid->column('permissions.name'),
608+
$grid->column('permissions.name');
608609
```
609610
#### 一对多
610611
一对多最终得到的是数组,前端会自动循环展示,文本建议使用`Tag`组件,图片建议使用`Avatar``Image`组件
611612
```php
612-
$grid->column('permissions.name')->component(Tag::make()->type('info')),
613+
$grid->column('permissions.name')->component(Tag::make()->type('info'));
613614
```
614615

615616

@@ -627,7 +628,19 @@ $grid->column('permissions.name')->component(Tag::make()->type('info')),
627628
})
628629
```
629630

630-
#### 获取当前行的 index
631+
#### 操作栏宽度
632+
633+
```php
634+
$grid->actionWidth(180)
635+
```
636+
637+
#### 操作栏固定
638+
639+
```php
640+
$grid->actionFixed('right');// left | right
641+
```
642+
643+
#### 获取当前行的下标
631644

632645
v0.1.5 +
633646

@@ -643,8 +656,6 @@ $grid->column('permissions.name')->component(Tag::make()->type('info')),
643656
$actions->getRow();
644657
```
645658

646-
647-
648659
#### 隐藏所有操作
649660

650661
```php

public/1.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
3535
}, this.attrs.config));
3636
this.antv.render();
3737
},
38+
updated: function updated() {
39+
this.antv.changeData(this.attrs.data);
40+
},
3841
destroyed: function destroyed() {//this.antv.destory();
3942
}
4043
});

public/2.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
3535
}, this.attrs.config));
3636
this.antv.render();
3737
},
38+
updated: function updated() {
39+
this.antv.changeData(this.attrs.data);
40+
},
3841
destroyed: function destroyed() {//this.antv.destory();
3942
}
4043
});

public/3.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
3535
}, this.attrs.config));
3636
this.antv.render();
3737
},
38+
updated: function updated() {
39+
this.antv.changeData(this.attrs.data);
40+
},
3841
destroyed: function destroyed() {//this.antv.destory();
3942
}
4043
});

public/4.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/5.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/6.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/7.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/app.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)