summaryrefslogtreecommitdiff
path: root/framework/Web
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web')
-rw-r--r--framework/Web/UI/WebControls/TEditCommandColumn.php18
1 files changed, 13 insertions, 5 deletions
diff --git a/framework/Web/UI/WebControls/TEditCommandColumn.php b/framework/Web/UI/WebControls/TEditCommandColumn.php
index 6cb93a39..954ef8f7 100644
--- a/framework/Web/UI/WebControls/TEditCommandColumn.php
+++ b/framework/Web/UI/WebControls/TEditCommandColumn.php
@@ -153,7 +153,6 @@ class TEditCommandColumn extends TDataGridColumn
public function initializeCell($cell,$columnIndex,$itemType)
{
parent::initializeCell($cell,$columnIndex,$itemType);
- $buttonType=$this->getButtonType()=='LinkButton'?'TLinkButton':'TButton';
if($itemType==='Item' || $itemType==='AlternatingItem' || $itemType==='SelectedItem')
$this->addButtonToCell($cell,'Edit',$this->getEditText(),false,'');
else if($itemType==='EditItem')
@@ -174,16 +173,25 @@ class TEditCommandColumn extends TDataGridColumn
*/
protected function addButtonToCell($cell,$commandName,$text,$causesValidation,$validationGroup)
{
- if($this->getButtonType()==='LinkButton')
- $button=Prado::createComponent('System.Web.UI.WebControls.TLinkButton');
- else
- $button=Prado::createComponent('System.Web.UI.WebControls.TButton');
+ $button=$this->createButton();
$button->setText($text);
$button->setCommandName($commandName);
$button->setCausesValidation($causesValidation);
$button->setValidationGroup($validationGroup);
$cell->getControls()->add($button);
}
+
+ /**
+ * Creates a button by {@link getButtonType ButtonType}.
+ * @return mixed the newly created button.
+ */
+ protected function createButton()
+ {
+ if($this->getButtonType()==='LinkButton')
+ return Prado::createComponent('System.Web.UI.WebControls.TLinkButton');
+ else
+ return Prado::createComponent('System.Web.UI.WebControls.TButton');
+ }
}
?> \ No newline at end of file