diff options
6 files changed, 50 insertions, 3 deletions
diff --git a/.gitattributes b/.gitattributes index bf37df4b..7ed8d620 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2117,6 +2117,8 @@ tests/FunctionalTests/active-controls/protected/pages/DatePickerInCallback.page tests/FunctionalTests/active-controls/protected/pages/DatePickerInCallback.php -text tests/FunctionalTests/active-controls/protected/pages/DelayedCallback.page -text tests/FunctionalTests/active-controls/protected/pages/DelayedCallback.php -text +tests/FunctionalTests/active-controls/protected/pages/DynamicRepeaterDataTest.page -text +tests/FunctionalTests/active-controls/protected/pages/DynamicRepeaterDataTest.php -text tests/FunctionalTests/active-controls/protected/pages/EventTriggeredCallback.page -text tests/FunctionalTests/active-controls/protected/pages/EventTriggeredCallback.php -text tests/FunctionalTests/active-controls/protected/pages/GerTurno2.page -text diff --git a/framework/Web/Javascripts/js/compressed/prado.js b/framework/Web/Javascripts/js/compressed/prado.js index a1da1efb..e1c566e0 100644 --- a/framework/Web/Javascripts/js/compressed/prado.js +++ b/framework/Web/Javascripts/js/compressed/prado.js @@ -259,11 +259,11 @@ $('PRADO_POSTBACK_TARGET').value=options['EventTarget'];$('PRADO_POSTBACK_PARAME Prado.Element={setValue:function(element,value) {var el=$(element);if(el&&typeof(el.value)!="undefined") el.value=value;},select:function(element,method,value,total) -{var el=$(element);var selection=Prado.Element.Selection;if(typeof(selection[method])=="function") +{var el=$(element);if(!el)return;var selection=Prado.Element.Selection;if(typeof(selection[method])=="function") {control=selection.isSelectable(el)?[el]:selection.getListElements(element,total);selection[method](control,value);}},click:function(element) {var el=$(element);if(el) Event.fireEvent(el,'click');},setAttribute:function(element,attribute,value) -{var el=$(element);if((attribute=="disabled"||attribute=="multiple")&&value==false) +{var el=$(element);if(!el)return;if((attribute=="disabled"||attribute=="multiple")&&value==false) el.removeAttribute(attribute);else if(attribute.match(/^on/i)) {try {eval("(func = function(event){"+value+"})");el[attribute]=func;} @@ -271,7 +271,7 @@ catch(e) {throw"Error in evaluating '"+value+"' for attribute "+attribute+" for element "+element.id;}} else el.setAttribute(attribute,value);},setOptions:function(element,options) -{var el=$(element);if(el&&el.tagName.toLowerCase()=="select") +{var el=$(element);if(!el)return;if(el&&el.tagName.toLowerCase()=="select") {el.options.length=options.length;for(var i=0;i<options.length;i++) el.options[i]=new Option(options[i][0],options[i][1]);}},focus:function(element) {var obj=$(element);if(typeof(obj)!="undefined"&&typeof(obj.focus)!="undefined") diff --git a/framework/Web/Javascripts/js/debug/prado.js b/framework/Web/Javascripts/js/debug/prado.js index 9a6cc823..a1a224b9 100644 --- a/framework/Web/Javascripts/js/debug/prado.js +++ b/framework/Web/Javascripts/js/debug/prado.js @@ -2943,6 +2943,7 @@ Prado.Element = select : function(element, method, value, total)
{
var el = $(element);
+ if(!el) return;
var selection = Prado.Element.Selection;
if(typeof(selection[method]) == "function")
{
@@ -2961,6 +2962,7 @@ Prado.Element = setAttribute : function(element, attribute, value)
{
var el = $(element);
+ if(!el) return;
if((attribute == "disabled" || attribute == "multiple") && value==false)
el.removeAttribute(attribute);
else if(attribute.match(/^on/i)) //event methods
@@ -2982,6 +2984,7 @@ Prado.Element = setOptions : function(element, options)
{
var el = $(element);
+ if(!el) return;
if(el && el.tagName.toLowerCase() == "select")
{
el.options.length = options.length;
diff --git a/framework/Web/Javascripts/prado/element.js b/framework/Web/Javascripts/prado/element.js index 0d08a200..b21782fe 100644 --- a/framework/Web/Javascripts/prado/element.js +++ b/framework/Web/Javascripts/prado/element.js @@ -15,6 +15,7 @@ Prado.Element = select : function(element, method, value, total)
{
var el = $(element);
+ if(!el) return;
var selection = Prado.Element.Selection;
if(typeof(selection[method]) == "function")
{
@@ -33,6 +34,7 @@ Prado.Element = setAttribute : function(element, attribute, value)
{
var el = $(element);
+ if(!el) return;
if((attribute == "disabled" || attribute == "multiple") && value==false)
el.removeAttribute(attribute);
else if(attribute.match(/^on/i)) //event methods
@@ -54,6 +56,7 @@ Prado.Element = setOptions : function(element, options)
{
var el = $(element);
+ if(!el) return;
if(el && el.tagName.toLowerCase() == "select")
{
el.options.length = options.length;
diff --git a/tests/FunctionalTests/active-controls/protected/pages/DynamicRepeaterDataTest.page b/tests/FunctionalTests/active-controls/protected/pages/DynamicRepeaterDataTest.page new file mode 100644 index 00000000..913f6a17 --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/DynamicRepeaterDataTest.page @@ -0,0 +1,16 @@ +<com:TForm>
+<h1>Dynamic Repeater Data Test</h1>
+<com:TActiveButton Text="Click Me!" OnClick="button_clicked" OnCallback="button_callback"/>
+
+<com:TActivePanel ID="panel1" ActiveControl.EnableUpdate="true">
+<com:TRepeater id="_repeater">
+ <prop:ItemTemplate>
+ <com:TActiveButton Text="Button <%# $this->DataItem %>" OnClick="Page.rpt_button_clicked" />
+ <com:TActiveLabel ID="label1" />
+ </prop:ItemTemplate>
+</com:TRepeater>
+</com:TActivePanel>
+
+<com:TJavascriptLogger />
+
+</com:TForm>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/DynamicRepeaterDataTest.php b/tests/FunctionalTests/active-controls/protected/pages/DynamicRepeaterDataTest.php new file mode 100644 index 00000000..729a87dc --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/DynamicRepeaterDataTest.php @@ -0,0 +1,23 @@ +<?php
+
+class DynamicRepeaterDataTest extends TPage
+{
+ function button_clicked($sender, $param)
+ {
+ $this->_repeater->dataSource = array(1,2,3);
+ $this->_repeater->dataBind();
+ }
+
+ function button_callback($sender, $param)
+ {
+ $this->panel1->render($param->NewWriter);
+ }
+
+ function rpt_button_clicked($sender, $param)
+ {
+ $item = $sender->NamingContainer;
+ $item->label1->Text = $sender->Text;
+ }
+}
+
+?>
\ No newline at end of file |