我正在使用ATK4 4.1.1並在頁面中添加了一個按鈕。我希望這個按鈕在按下時觸發數據庫表的更新,所以在頁面中創建了類似這樣的代碼。如何讓按鈕觸發ATK4中的數據庫更新?
$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
感謝
你能確認addButton的語法嗎?在4.1上,我收到一個錯誤,說沒有爲此對象addButton定義方法。 – 2012-08-04 18:11:47
確定 - 制定了正確的語法添加按鈕,並修改了上述內容,但現在得到一個Ajax錯誤,當按下按鈕時沒有任何信息爲什麼 - 任何建議? POST URL是http://team.pscrum/?page = tktdetail&paperless_tktdetail_button =點擊 – 2012-08-04 18:23:44