@@ -60,37 +60,40 @@ protected function getTable() {
6060
6161
6262 public function compile (JsUtils $ js =NULL ,&$ view =NULL ){
63- $ this ->_instanceViewer ->setInstance ($ this ->_model );
64- $ captions =$ this ->_instanceViewer ->getCaptions ();
63+ if (!$ this ->_generated ){
64+ $ this ->_instanceViewer ->setInstance ($ this ->_model );
65+ $ captions =$ this ->_instanceViewer ->getCaptions ();
6566
66- $ table =$ this ->content ["table " ];
67+ $ table =$ this ->content ["table " ];
6768
68- if ($ this ->_hasCheckboxes ){
69- $ this ->_generateMainCheckbox ($ captions );
70- }
69+ if ($ this ->_hasCheckboxes ){
70+ $ this ->_generateMainCheckbox ($ captions );
71+ }
7172
72- $ table ->setRowCount (0 , \sizeof ($ captions ));
73- $ table ->setHeaderValues ($ captions );
74- if (isset ($ this ->_compileParts ))
75- $ table ->setCompileParts ($ this ->_compileParts );
76- if (isset ($ this ->_searchField ) && isset ($ js )){
77- $ this ->_searchField ->postOn ("change " , $ this ->_urls ,"{'s':$(this).val()} " ,"# " .$ this ->identifier ." tbody " ,["preventDefault " =>false ,"jqueryDone " =>"replaceWith " ]);
78- }
73+ $ table ->setRowCount (0 , \sizeof ($ captions ));
74+ $ table ->setHeaderValues ($ captions );
75+ if (isset ($ this ->_compileParts ))
76+ $ table ->setCompileParts ($ this ->_compileParts );
77+ if (isset ($ this ->_searchField ) && isset ($ js )){
78+ $ this ->_searchField ->postOn ("change " , $ this ->_urls ,"{'s':$(this).val()} " ,"# " .$ this ->identifier ." tbody " ,["preventDefault " =>false ,"jqueryDone " =>"replaceWith " ]);
79+ }
7980
80- $ this ->_generateContent ($ table );
81+ $ this ->_generateContent ($ table );
8182
82- if ($ this ->_hasCheckboxes && $ table ->hasPart ("thead " )){
83- $ table ->getHeader ()->getCell (0 , 0 )->addToProperty ("class " ,"no-sort " );
84- }
83+ if ($ this ->_hasCheckboxes && $ table ->hasPart ("thead " )){
84+ $ table ->getHeader ()->getCell (0 , 0 )->addToProperty ("class " ,"no-sort " );
85+ }
8586
86- if (isset ($ this ->_pagination ) && $ this ->_pagination ->getVisible ()){
87- $ this ->_generatePagination ($ table );
88- }
89- if (isset ($ this ->_toolbar )){
90- $ this ->_setToolbarPosition ($ table , $ captions );
87+ if (isset ($ this ->_pagination ) && $ this ->_pagination ->getVisible ()){
88+ $ this ->_generatePagination ($ table );
89+ }
90+ if (isset ($ this ->_toolbar )){
91+ $ this ->_setToolbarPosition ($ table , $ captions );
92+ }
93+ $ this ->content =JArray::sortAssociative ($ this ->content , [PositionInTable::BEFORETABLE ,"table " ,PositionInTable::AFTERTABLE ]);
94+ $ this ->_compileForm ();
95+ $ this ->_generated =true ;
9196 }
92- $ this ->content =JArray::sortAssociative ($ this ->content , [PositionInTable::BEFORETABLE ,"table " ,PositionInTable::AFTERTABLE ]);
93- $ this ->_compileForm ();
9497 return parent ::compile ($ js ,$ view );
9598 }
9699
@@ -296,7 +299,7 @@ public function insertInFieldButton($index,$caption,$visibleHover=true,$callback
296299 }
297300
298301 private function addDefaultButton ($ icon ,$ class =null ,$ visibleHover =true ,$ callback =null ){
299- $ this ->addField ($ this ->getCallable ("getDefaultButton " ,[$ icon ,$ class] ,$ visibleHover ,$ callback ));
302+ $ this ->addField ($ this ->getCallable ("getDefaultButton " ,[$ icon ,$ class ,$ visibleHover] ,$ callback ));
300303 return $ this ;
301304 }
302305
0 commit comments