Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

数据仓库有其他字段需要传递给列表页 #1373

Closed
keke996 opened this issue Jul 12, 2021 · 3 comments
Closed

数据仓库有其他字段需要传递给列表页 #1373

keke996 opened this issue Jul 12, 2021 · 3 comments
Labels
question Further information is requested wontfix This will not be worked on

Comments

@keke996
Copy link

keke996 commented Jul 12, 2021

  • Laravel Version: 8.x
  • PHP Version: 7.3
  • Dcat Admin Version: 2.x

Description:

数据仓库给grid只能传递列表和总条数吗?我的数据仓库是从外部api获取数据,但是我从api获取的其实还有该筛选条件下所有数据的总和统计,不在list内,需要放在页头或者页脚展示。dcat-admin有什么方法可以应对这种需求吗,望有人能给出解答

Steps To Reproduce:

@jqhph
Copy link
Owner

jqhph commented Jul 12, 2021

方法很多,比如你可以直接保存在类属性上,或者是其他一些静态属性也行

public $test;

public function get(Grid\Model $model)
{
      $this->test= [...];

      ...
}

使用

$grid->header(function ()  use ($grid) {
     // 拿到前面保存好的数据
     $test = $grid->model()->repository()->test;
});

@jqhph jqhph added the question Further information is requested label Jul 12, 2021
@keke996
Copy link
Author

keke996 commented Jul 12, 2021

写在grid里是不是会重复操作很多次

@stale
Copy link

stale bot commented Nov 9, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Nov 9, 2021
@stale stale bot closed this as completed Nov 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants