File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -276,6 +276,7 @@ function ppom_admin_save_form_meta() {
276
276
}
277
277
278
278
$ _REQUEST ['ppom ' ] = is_array ( $ _REQUEST ['ppom ' ] ) ? $ _REQUEST ['ppom ' ] : json_decode ( wp_unslash ( $ _REQUEST ['ppom ' ] ), true );
279
+
279
280
global $ wpdb ;
280
281
281
282
extract ( $ _REQUEST );
@@ -453,6 +454,7 @@ function ppom_admin_update_form_meta() {
453
454
wp_send_json ( $ resp );
454
455
}
455
456
$ _REQUEST ['ppom ' ] = is_array ( $ _REQUEST ['ppom ' ] ) ? $ _REQUEST ['ppom ' ] : json_decode ( wp_unslash ( $ _REQUEST ['ppom ' ] ), true );
457
+
456
458
global $ wpdb ;
457
459
458
460
$ ppom_meta = isset ( $ _REQUEST ['ppom_meta ' ] ) ? $ _REQUEST ['ppom_meta ' ] : $ _REQUEST ['ppom ' ];
Original file line number Diff line number Diff line change @@ -128,8 +128,14 @@ jQuery(function($) {
128
128
jQuery ( ".ppom-meta-save-notice" ) . html ( '<img src="' + ppom_vars . loader + '">' ) . show ( ) ;
129
129
130
130
$ ( '.ppom-unsave-data' ) . remove ( ) ;
131
- var data = $ ( this ) . serializeJSON ( ) ;
131
+ const data = $ ( this ) . serializeJSON ( ) ;
132
+
133
+ const fieldsOrder = Array ( ...document . querySelectorAll ( '.ui-sortable-handle[id^="ppom_sort_id_"]' ) )
134
+ . map ( node => node . id . replace ( 'ppom_sort_id_' , '' ) ) ; // ['2', '3']
135
+ data . ppom = fieldsOrder . map ( fieldId => data . ppom [ fieldId ] ) ;
136
+
132
137
data . ppom = JSON . stringify ( data . ppom ) ;
138
+
133
139
// Send the JSON data via POST request
134
140
$ . ajax ( {
135
141
url : ajaxurl ,
@@ -329,7 +335,7 @@ jQuery(function($) {
329
335
placeholder = '-' ;
330
336
}
331
337
332
- var html = '<tr class="row_no_' + id + '" id="ppom_sort_id_' + id + '">' ;
338
+ var html = '<tr class="row_no_' + id + ' ui-sortable-handle " id="ppom_sort_id_' + id + '">' ;
333
339
html += '<td class="ppom-sortable-handle"><i class="fa fa-arrows" aria-hidden="true"></i></td>' ;
334
340
html += '<td class="ppom-check-one-field ppom-checkboxe-style">' ;
335
341
html += '<label>' ;
You can’t perform that action at this time.
0 commit comments