我正在使用 ATK4 4.1.1 并向页面添加了一个按钮。我希望此按钮在按下时触发对数据库表的更新,因此在页面中创建了这样的代码。
$f=$p->add('Form',null,null,array('form_empty'))->setFormClass('horizontal bottom-padded');
$b1=$f->add('Button')->set('Finished');
$b1->js("click")->univ()->ajaxec($this->api->url(null, array("s"=>"D")));
$b1->js('click', $b1->js()->load(
$this->api->url(null,array('s'=>'D'))
) );
.. .. .. ..
if (isset($_GET['s'])) {
$ss=$this->add('Model_SprintStatus')
->loadBy(array('member_id'=>$p->api->auth->get('id')));
$new_status=$_GET['s'];
$ss->set('status',$new_status);
$ss->update();
}
当我访问此页面时,它显示正常,但是当单击按钮时,我收到一条错误消息
BaseException
Method is not defined for this object
Additional information:
method: url
arguments: Array ( [0] => [1] => Array ( [s] => D )
我使用了以下agiletoolkit.org部分中的一个示例,称为重新加载解剖。当我收到此错误时,我采用了示例并使用与示例相同的代码创建了一个新页面,并且我也从该页面收到了类似的错误。
BaseException
Method is not defined for this object
Additional information:
method: url
arguments: Array ( [0] => [1] => Array ( [side] => 1 [myajax] => 1 ) )
除了尝试上面的 ajaxec 行之外,我还尝试了以下
$b1->js('click', $b1->js()->load( $this->api->url(null,array('s'=>'D'))));
和
$b1->js('click', $b1->js()->atk4_load( $this->api->url(null,array('s'=>'D'))));
但他们也回来了同样的错误。
也许我错过了一些东西,或者它可能是 ATK4 4.1.1 和 4.2 之间的变化,但我目前无法升级,因为试图赶上最后期限,所以我必须通过什么方法从在 ATK 4.1.1 中单击按钮
谢谢