File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -107,22 +107,26 @@ function init() {
107107
108108 restart_inputs ( ) ;
109109
110- sortable ( ".sortable" , {
111- axis : "y" ,
112- handle : ".handle" ,
113- cursor : "move" ,
114- dropOnEmpty : true ,
115- scroll : true ,
116- } ) [ 0 ] . addEventListener ( "sortupdate" , function ( e ) {
117- let order = $ ( ".table tr[data-id]" ) . toArray ( ) . map ( a => $ ( a ) . data ( "id" ) )
118-
119- $ . post ( globals . rootdir + "/actions.php" , {
120- id_module : globals . id_module ,
121- id_record : globals . id_record ,
122- op : "update_position" ,
123- order : order . join ( "," ) ,
110+ const sortableElement = sortable ( ".sortable" , {
111+ axis : "y" ,
112+ handle : ".handle" ,
113+ cursor : "move" ,
114+ dropOnEmpty : true ,
115+ scroll : true ,
116+ } ) [ 0 ] ;
117+
118+ if ( sortableElement ) {
119+ sortableElement . addEventListener ( "sortupdate" , function ( e ) {
120+ let order = $ ( ".table tr[data-id]" ) . toArray ( ) . map ( a => $ ( a ) . data ( "id" ) )
121+
122+ $ . post ( globals . rootdir + "/actions.php" , {
123+ id_module : globals . id_module ,
124+ id_record : globals . id_record ,
125+ op : "update_position" ,
126+ order : order . join ( "," ) ,
127+ } ) ;
124128 } ) ;
125- } ) ;
129+ }
126130}
127131
128132/**
You can’t perform that action at this time.
0 commit comments