summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY1
-rw-r--r--demos/quickstart/protected/pages/Controls/Pager.page4
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TPager/Sample1.page19
-rw-r--r--framework/Web/UI/WebControls/TPager.php23
4 files changed, 45 insertions, 2 deletions
diff --git a/HISTORY b/HISTORY
index 5831acb4..730c1fcc 100644
--- a/HISTORY
+++ b/HISTORY
@@ -7,6 +7,7 @@ BUG: Issue #415 - prado-cli throws an error if the application is making use of
BUG: Issue #416 - TJsonService reports the wrong content-type (ctrlaltca)
BUG: Issue #417 - TActiveCustomValidator and Display=Dynamic not work anymore (sampsa.saarela)
BUG: Issue #418 - Can't get parameters when friendly url enabled with UrlFormat=Path (sampsa.saarela)
+ENH: Issue #419 - CssClass for PushButtons of TPager (ctrlaltca)
ENH: Issue #420 - Permit to easily mock TActiveRecordgateway for unit testing (mvschaik)
EHN: Permit to change the default cipher in TSecurityManager::setEncryption(); changed the default cipher from 3DES to AES256 (ctrlaltca)
diff --git a/demos/quickstart/protected/pages/Controls/Pager.page b/demos/quickstart/protected/pages/Controls/Pager.page
index 5f4136b1..1ec0b7cb 100644
--- a/demos/quickstart/protected/pages/Controls/Pager.page
+++ b/demos/quickstart/protected/pages/Controls/Pager.page
@@ -29,6 +29,10 @@ These user interfaces may be further customized by configuring the following pro
<li><tt>ButtonType</tt> - type of page buttons, either <tt>PushButton</tt> meaning normal form submission buttons, or <tt>LinkButton</tt> meaning hyperlink buttons.</li>
</ul>
+<p class="block-content">
+Since Prado 3.2.1, you can use the <tt>ButtonCssClass</tt> property to specify a css class that will be applied to each button created by the pager in NextPrev or Numeric mode.
+</p>
+
<p id="450304" class="block-content">
<tt>TPager</tt> raises an <tt>OnPageIndexChanged</tt> event when an end-user interacts with it and specifies a new page (e.g. by clicking on a next page button that would lead to the next page.) Developers may write handlers to respond to this event and obtain the desired new page index from the event parameter's property <tt>NewPageIndex</tt>. Using this new page index, one can feed a new page of data to the associated data-bound control.
</p>
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TPager/Sample1.page b/demos/quickstart/protected/pages/Controls/Samples/TPager/Sample1.page
index df7ce8fd..e70f8e77 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TPager/Sample1.page
+++ b/demos/quickstart/protected/pages/Controls/Samples/TPager/Sample1.page
@@ -2,7 +2,7 @@
<h1>TPager Sample</h1>
<p>
-The following sample displays three different pagers associated with a single TDataList control. The datalist control is enabled with custom paging, which allows it to read only one page of data each time. This is typical in DB-driven applications.
+The following sample displays four different pagers associated with a single TDataList control. The datalist control is enabled with custom paging, which allows it to read only one page of data each time. This is typical in DB-driven applications.
</p>
<div>
@@ -73,5 +73,20 @@ Choose page:
Mode="DropDownList"
OnPageIndexChanged="pageChanged"
/>
-
+<br/>
+Use of a css class for buttons:
+<com:TStyleSheet>
+.greenbold_button {
+ background-color: #0f0;
+ font-weight: bold;
+}
+</com:TStyleSheet>
+<com:TPager ID="Pager4"
+ ControlToPaginate="DataList"
+ PageButtonCount="3"
+ Mode="Numeric"
+ ButtonType="PushButton"
+ OnPageIndexChanged="pageChanged"
+ ButtonCssClass="greenbold_button"
+ />
</com:TContent>
diff --git a/framework/Web/UI/WebControls/TPager.php b/framework/Web/UI/WebControls/TPager.php
index 11de5233..9551476f 100644
--- a/framework/Web/UI/WebControls/TPager.php
+++ b/framework/Web/UI/WebControls/TPager.php
@@ -32,6 +32,9 @@
* - PushButton: a normal button
* - ImageButton: an image button (please set XXXPageImageUrl properties accordingly to specify the button images.)
*
+ * Since Prado 3.2.1, you can use the {@link setButtonCssClass ButtonCssClass} property to specify a css class
+ * that will be applied to each button created by the pager in NextPrev or Numeric mode.
+ *
* TPager raises an {@link onPageIndexChanged OnPageIndexChanged} event when
* the end-user interacts with it and specifies a new page (e.g. clicking
* on a page button that leads to a new page.) The new page index may be obtained
@@ -94,6 +97,24 @@ class TPager extends TWebControl implements INamingContainer
}
/**
+ * @return string the css class of the buttons.
+ * @since 3.2.1
+ */
+ public function getButtonCssClass()
+ {
+ return $this->getViewState('ButtonCssClass','');
+ }
+
+ /**
+ * @param Sets the css class of the buttons that will be rendered by this pager.
+ * @since 3.2.1
+ */
+ public function setButtonCssClass($value)
+ {
+ $this->setViewState('ButtonCssClass',TPropertyValue::ensureString($value,''),'');
+ }
+
+ /**
* @return TPagerMode pager mode. Defaults to TPagerMode::NextPrev.
*/
public function getMode()
@@ -439,6 +460,7 @@ class TPager extends TWebControl implements INamingContainer
{
$button=new TLabel;
$button->setText($text);
+ $button->setCssClass($this->getButtonCssClass());
return $button;
}
}
@@ -458,6 +480,7 @@ class TPager extends TWebControl implements INamingContainer
$button->setCommandName($commandName);
$button->setCommandParameter($commandParameter);
$button->setCausesValidation(false);
+ $button->setCssClass($this->getButtonCssClass());
return $button;
}