File tree Expand file tree Collapse file tree 2 files changed +33
-4
lines changed Expand file tree Collapse file tree 2 files changed +33
-4
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,8 @@ class ConfigParser
3030 'csv ' => true ,
3131 'nesting ' => 0 ,
3232 'index ' => 0 ,
33- 'classes ' => []
33+ 'classes ' => [],
34+ 'actcol ' => -1 ,
3435 ];
3536
3637 /**
@@ -131,6 +132,11 @@ public function __construct($lines)
131132 case 'classes ' :
132133 $ this ->config ['classes ' ] = $ this ->parseClasses ($ val );
133134 break ;
135+ case 'actcol ' :
136+ case 'actioncol ' :
137+ case 'actioncolumn ' :
138+ $ this ->config ['actcol ' ] = (int ) $ val ;
139+ break ;
134140 default :
135141 $ data = ['config ' => &$ this ->config , 'key ' => $ key , 'val ' => $ val ];
136142 $ ev = new Event ('PLUGIN_STRUCT_CONFIGPARSER_UNKNOWNKEY ' , $ data );
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ const AggregationEditor = function (idx, table) {
3131
3232 // empty header cells
3333 if ( ! rid ) {
34- $me . append ( '<th class="action">' + LANG . plugins . struct . actions + '</th>' ) ;
34+ insertActionCell ( $me , '<th class="action">' + LANG . plugins . struct . actions + '</th>' ) ;
3535 return ;
3636 }
3737
@@ -68,11 +68,34 @@ const AggregationEditor = function (idx, table) {
6868 } ) ;
6969
7070 $td . append ( $btn ) ;
71- $me . append ( $td ) ;
72-
71+ insertActionCell ( $me , $td ) ;
7372 } ) ;
7473 }
7574
75+ /**
76+ * Insert the action cell at the right position, depending on the actcol setting
77+ *
78+ * @param {jQuery<HTMLTableRowElement> } $row
79+ * @param {jQuery<HTMLTableCellElement> } $cell
80+ */
81+ function insertActionCell ( $row , $cell ) {
82+ const $children = $row . children ( ) ;
83+ let insertAt = searchconf . actcol ;
84+ if ( insertAt < 0 ) insertAt = $children . length + 1 + insertAt ;
85+ console . log ( "insertAt" , insertAt ) ;
86+
87+ if ( insertAt >= $children . length ) {
88+ console . log ( "append" ) ;
89+ $row . append ( $cell ) ;
90+ } else if ( insertAt < 0 ) {
91+ console . log ( "prepend" ) ;
92+ $row . prepend ( $cell ) ;
93+ } else {
94+ console . log ( "insertBefore" ) ;
95+ $children . eq ( insertAt ) . before ( $cell ) ;
96+ }
97+ }
98+
7699 /**
77100 * Initializes the form for the editor and attaches handlers
78101 *
You can’t perform that action at this time.
0 commit comments