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
30
30
'csv ' => true ,
31
31
'nesting ' => 0 ,
32
32
'index ' => 0 ,
33
- 'classes ' => []
33
+ 'classes ' => [],
34
+ 'actcol ' => -1 ,
34
35
];
35
36
36
37
/**
@@ -131,6 +132,11 @@ public function __construct($lines)
131
132
case 'classes ' :
132
133
$ this ->config ['classes ' ] = $ this ->parseClasses ($ val );
133
134
break ;
135
+ case 'actcol ' :
136
+ case 'actioncol ' :
137
+ case 'actioncolumn ' :
138
+ $ this ->config ['actcol ' ] = (int ) $ val ;
139
+ break ;
134
140
default :
135
141
$ data = ['config ' => &$ this ->config , 'key ' => $ key , 'val ' => $ val ];
136
142
$ 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) {
31
31
32
32
// empty header cells
33
33
if ( ! rid ) {
34
- $me . append ( '<th class="action">' + LANG . plugins . struct . actions + '</th>' ) ;
34
+ insertActionCell ( $me , '<th class="action">' + LANG . plugins . struct . actions + '</th>' ) ;
35
35
return ;
36
36
}
37
37
@@ -68,11 +68,34 @@ const AggregationEditor = function (idx, table) {
68
68
} ) ;
69
69
70
70
$td . append ( $btn ) ;
71
- $me . append ( $td ) ;
72
-
71
+ insertActionCell ( $me , $td ) ;
73
72
} ) ;
74
73
}
75
74
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
+
76
99
/**
77
100
* Initializes the form for the editor and attaches handlers
78
101
*
You can’t perform that action at this time.
0 commit comments