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

Fixes and few new features (insert, delete) #92

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ class Column
/** @var Datagrid */
protected $grid;

/** @var array */
protected $attributes = [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea what is the purpose.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example

$grid->addColumn('institute')->setAttribute('help', 'School where you ...');

and then you can render nice help icon in column head.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🆗



public function __construct($name, $label, Datagrid $grid)
{
Expand All @@ -37,6 +40,39 @@ public function __construct($name, $label, Datagrid $grid)
}


/**
* @param string $name
* @param mixed $value
* @return self
*/
public function setAttribute($name, $value = true)
{
$this->attributes[$name] = $value;
return $this;
}


/**
* @param string $name
* @return bool
*/
public function hasAttribute($name)
{
return isset($this->attributes[$name]);
}


/**
* @param string $name
* @param mixed $default
* @return self
*/
public function getAttribute($name, $default = null)
{
return $this->attributes[$name] ?? $default;
}


public function enableSort($default = NULL)
{
$this->sort = TRUE;
Expand Down