@@ -23,8 +23,7 @@ class HtmlTable extends HtmlSemDoubleElement {
2323 private $ _compileParts ;
2424 private $ _footer ;
2525 private $ _afterCompileEvents ;
26- private $ _activeClass ="warning " ;
27- private $ _activeRowEvent ="click " ;
26+ private $ _activeRowSelector ;
2827
2928 public function __construct ($ identifier , $ rowCount , $ colCount ) {
3029 parent ::__construct ($ identifier , "table " , "ui table " );
@@ -252,8 +251,8 @@ protected function compile_once(JsUtils $js=NULL, &$view=NULL) {
252251 if ($ this ->propertyContains ("class " , "sortable " )) {
253252 $ this ->addEvent ("execute " , "$('# " . $ this ->identifier . "').tablesort().data('tablesort').sort($('th.default-sort')); " );
254253 }
255- if (isset ($ this ->_activeClass )){
256- $ this ->onRow ( $ this -> _activeRowEvent , " $(this).toggleClass(' " . $ this -> _activeClass . " '); " );
254+ if (isset ($ this ->_activeRowSelector )){
255+ $ this ->_activeRowSelector -> compile ( );
257256 }
258257 }
259258
@@ -309,15 +308,8 @@ public function onNewRow($callback) {
309308 return $ this ;
310309 }
311310
312- public function setActiveClass ( $ _activeClass ) {
313- $ this ->_activeClass = $ _activeClass ;
311+ public function setActiveRowSelector ( $ class = " active " , $ event = " click " , $ multiple = false ) {
312+ $ this ->_activeRowSelector = new ActiveRow ( $ this , $ class , $ event , $ multiple ) ;
314313 return $ this ;
315314 }
316-
317- public function setActiveRowEvent ($ _activeRowEvent ) {
318- $ this ->_activeRowEvent =$ _activeRowEvent ;
319- return $ this ;
320- }
321-
322-
323315}
0 commit comments