99use Ajax \semantic \html \collections \menus \HtmlPaginationMenu ;
1010use Ajax \semantic \html \modules \checkbox \HtmlCheckbox ;
1111use Ajax \semantic \html \elements \HtmlButton ;
12- use Ajax \semantic \html \collections \menus \HtmlMenu ;
1312use Ajax \semantic \html \base \constants \Direction ;
1413use Ajax \service \JArray ;
1514use Ajax \semantic \widgets \base \FieldAsTrait ;
1615use Ajax \semantic \html \base \HtmlSemDoubleElement ;
16+ use Ajax \semantic \widgets \base \InstanceViewerCaption ;
1717
1818/**
1919 * DataTable widget for displaying list of objects
20+ * @version 1.0
2021 * @author jc
22+ * @since 2.2
2123 *
2224 */
2325class DataTable extends Widget {
@@ -27,9 +29,7 @@ class DataTable extends Widget {
2729 protected $ _urls ;
2830 protected $ _pagination ;
2931 protected $ _hasCheckboxes ;
30- protected $ _toolbar ;
3132 protected $ _compileParts ;
32- protected $ _toolbarPosition ;
3333
3434 public function run (JsUtils $ js ){
3535 if ($ this ->_hasCheckboxes && isset ($ js )){
@@ -43,7 +43,7 @@ public function run(JsUtils $js){
4343
4444 public function __construct ($ identifier ,$ model ,$ modelInstance =NULL ) {
4545 parent ::__construct ($ identifier , $ model ,$ modelInstance );
46- $ this ->_instanceViewer =new InstanceViewer ();
46+ $ this ->_instanceViewer =new InstanceViewerCaption ();
4747 $ this ->content =["table " =>new HtmlTable ($ identifier , 0 ,0 )];
4848 $ this ->_toolbarPosition =PositionInTable::BEFORETABLE ;
4949 }
@@ -92,10 +92,10 @@ private function _generateContent($table){
9292 if (isset ($ this ->_pagination )){
9393 $ objects =$ this ->_pagination ->getObjects ($ this ->_modelInstance );
9494 }
95- InstanceViewer ::setIndex (0 );
95+ InstanceViewerCaption ::setIndex (0 );
9696 $ table ->fromDatabaseObjects ($ objects , function ($ instance ){
9797 $ this ->_instanceViewer ->setInstance ($ instance );
98- InstanceViewer ::$ index ++;
98+ InstanceViewerCaption ::$ index ++;
9999 $ result = $ this ->_instanceViewer ->getValues ();
100100 if ($ this ->_hasCheckboxes ){
101101 $ ck =new HtmlCheckbox ("ck- " .$ this ->identifier ,"" );
@@ -342,45 +342,6 @@ public function setSelectable(){
342342 return $ this ;
343343 }
344344
345- /**
346- * @return \Ajax\semantic\html\collections\menus\HtmlMenu
347- */
348- public function getToolbar (){
349- if (isset ($ this ->_toolbar )===false ){
350- $ this ->_toolbar =new HtmlMenu ("toolbar- " .$ this ->identifier );
351- $ this ->_toolbar ->setSecondary ();
352- }
353- return $ this ->_toolbar ;
354- }
355-
356- /**
357- * Adds a new element in toolbar
358- * @param mixed $element
359- * @return \Ajax\common\html\HtmlDoubleElement
360- */
361- public function addInToolbar ($ element ){
362- $ tb =$ this ->getToolbar ();
363- return $ tb ->addItem ($ element );
364- }
365-
366- public function addItemInToolbar ($ caption ,$ icon =NULL ){
367- $ result =$ this ->addInToolbar ($ caption );
368- $ result ->addIcon ($ icon );
369- return $ result ;
370- }
371-
372- public function addButtonInToolbar ($ caption ){
373- $ bt =new HtmlButton ("" ,$ caption );
374- return $ this ->addInToolbar ($ bt );
375- }
376-
377- public function addLabelledIconButtonInToolbar ($ caption ,$ icon ,$ before =true ,$ labeled =false ){
378- $ bt =new HtmlButton ("" ,$ caption );
379- $ bt ->addIcon ($ icon ,$ before ,$ labeled );
380- return $ this ->addInToolbar ($ bt );
381- }
382-
383-
384345 public function addSearchInToolbar (){
385346 return $ this ->addInToolbar ($ this ->getSearchField ())->setPosition ("right " );
386347 }
0 commit comments