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
Show 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,19 +116,31 @@ class Column extends Object
...
@@ -116,19 +116,31 @@ class Column extends Object
}
}
/**
/**
*
Renders the
data cell content.
*
Get the raw
data cell content.
* @param mixed $model the data model
* @param mixed $model the data model
* @param mixed $key the key associated with 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]].
* @param integer $index the zero-based index of the data model among the models array returned by [[GridView::dataProvider]].
* @return string the rendering result
* @return string the rendering result
*/
*/
protected
function
render
DataCellContent
(
$model
,
$key
,
$index
)
protected
function
get
DataCellContent
(
$model
,
$key
,
$index
)
{
{
if
(
$this
->
content
!==
null
)
{
if
(
$this
->
content
!==
null
)
{
return
call_user_func
(
$this
->
content
,
$model
,
$key
,
$index
,
$this
);
return
call_user_func
(
$this
->
content
,
$model
,
$key
,
$index
,
$this
);
}
else
{
}
else
{
return
$this
->
grid
->
emptyCell
;
return
null
;
}
}
}
/**
* 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
;
}
}
/**
/**
...
...
framework/grid/DataColumn.php
View file @
3ad7d6d3
...
@@ -136,9 +136,9 @@ class DataColumn extends Column
...
@@ -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
(
$this
->
value
!==
null
)
{
if
(
is_string
(
$this
->
value
))
{
if
(
is_string
(
$this
->
value
))
{
...
@@ -149,8 +149,16 @@ class DataColumn extends Column
...
@@ -149,8 +149,16 @@ class DataColumn extends Column
}
elseif
(
$this
->
content
===
null
&&
$this
->
attribute
!==
null
)
{
}
elseif
(
$this
->
content
===
null
&&
$this
->
attribute
!==
null
)
{
$value
=
ArrayHelper
::
getValue
(
$model
,
$this
->
attribute
);
$value
=
ArrayHelper
::
getValue
(
$model
,
$this
->
attribute
);
}
else
{
}
else
{
return
parent
::
renderDataCellContent
(
$model
,
$key
,
$index
);
return
parent
::
getDataCellContent
(
$model
,
$key
,
$index
);
}
return
$value
;
}
}
return
$this
->
grid
->
formatter
->
format
(
$value
,
$this
->
format
);
/**
* @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