|
2 | 2 | namespace Ajax\semantic\widgets\datatable;
|
3 | 3 | use Ajax\semantic\html\elements\HtmlButton;
|
4 | 4 | use Ajax\semantic\widgets\base\InstanceViewer;
|
| 5 | +use Ajax\semantic\html\base\HtmlSemDoubleElement; |
5 | 6 |
|
6 | 7 | /**
|
7 | 8 | * @author jc
|
@@ -61,6 +62,30 @@ private function getFieldButton($caption,$visibleHover=true){
|
61 | 62 | return $bt;
|
62 | 63 | }
|
63 | 64 |
|
| 65 | + /** |
| 66 | + * Creates a submit button at $index position |
| 67 | + * @param int $index |
| 68 | + * @param string $cssStyle |
| 69 | + * @param string $url |
| 70 | + * @param string $responseElement |
| 71 | + * @param array $attributes associative array (<b>ajax</b> key is for ajax post) |
| 72 | + * @return \Ajax\semantic\widgets\datatable\DataTable |
| 73 | + */ |
| 74 | + public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){ |
| 75 | + return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$index,$attributes){ |
| 76 | + $button=new HtmlButton($id,$value,$cssStyle); |
| 77 | + $button->postOnClick($url,"$(event.target).closest('tr').find(':input').serialize()",$responseElement,$attributes["ajax"]); |
| 78 | + if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) |
| 79 | + $this->_visibleOver($button); |
| 80 | + return $button; |
| 81 | + }, $index,$attributes); |
| 82 | + } |
| 83 | + |
| 84 | + protected function _visibleOver($element){ |
| 85 | + $this->_visibleHover=true; |
| 86 | + return $element->addToProperty("class", "visibleover")->setProperty("style","visibility:hidden;"); |
| 87 | + } |
| 88 | + |
64 | 89 | /**
|
65 | 90 | * Inserts a new Button for each row
|
66 | 91 | * @param string $caption
|
|
0 commit comments