Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
3ad7d6d3
Commit
3ad7d6d3
authored
Feb 25, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2284 from kartik-v/patch-12
Raw content return for Grid DataColumn & Column
parents
725ec9a9
cd1f7b10
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
7 deletions
+27
-7
Column.php
framework/grid/Column.php
+15
-3
DataColumn.php
framework/grid/DataColumn.php
+12
-4
No files found.
framework/grid/Column.php
View file @
3ad7d6d3
...
...
@@ -116,22 +116,34 @@ class Column extends Object
}
/**
*
Renders the
data cell content.
*
Get the raw
data cell content.
* @param mixed $model the data model
* @param mixed $key the key associated with the data model
* @param integer $index the zero-based index of the data model among the models array returned by [[GridView::dataProvider]].
* @return string the rendering result
*/
protected
function
render
DataCellContent
(
$model
,
$key
,
$index
)
protected
function
get
DataCellContent
(
$model
,
$key
,
$index
)
{
if
(
$this
->
content
!==
null
)
{
return
call_user_func
(
$this
->
content
,
$model
,
$key
,
$index
,
$this
);
}
else
{
return
$this
->
grid
->
emptyCe
ll
;
return
nu
ll
;
}
}
/**
* Renders the data cell content.
* @param mixed $model the data model
* @param mixed $key the key associated with the data model
* @param integer $index the zero-based index of the data model among the models array returned by [[GridView::dataProvider]].
* @return string the rendering result
*/
protected
function
renderDataCellContent
(
$model
,
$key
,
$index
)
{
return
(
$this
->
content
!==
null
)
?
$this
->
getDataCellContent
(
$model
,
$key
,
$index
)
:
$this
->
grid
->
emptyCell
;
}
/**
* Renders the filter cell content.
* The default implementation simply renders a space.
* This method may be overridden to customize the rendering of the filter cell (if any).
...
...
framework/grid/DataColumn.php
View file @
3ad7d6d3
...
...
@@ -136,9 +136,9 @@ class DataColumn extends Column
}
/**
*
@inheritdoc
*
Return raw content
*/
protected
function
render
DataCellContent
(
$model
,
$key
,
$index
)
protected
function
get
DataCellContent
(
$model
,
$key
,
$index
)
{
if
(
$this
->
value
!==
null
)
{
if
(
is_string
(
$this
->
value
))
{
...
...
@@ -149,8 +149,16 @@ class DataColumn extends Column
}
elseif
(
$this
->
content
===
null
&&
$this
->
attribute
!==
null
)
{
$value
=
ArrayHelper
::
getValue
(
$model
,
$this
->
attribute
);
}
else
{
return
parent
::
render
DataCellContent
(
$model
,
$key
,
$index
);
return
parent
::
get
DataCellContent
(
$model
,
$key
,
$index
);
}
return
$this
->
grid
->
formatter
->
format
(
$value
,
$this
->
format
);
return
$value
;
}
/**
* @inheritdoc
*/
protected
function
renderDataCellContent
(
$model
,
$key
,
$index
)
{
return
$this
->
grid
->
formatter
->
format
(
$this
->
getDataCellContent
(
$model
,
$key
,
$index
),
$this
->
format
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment