File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -271,6 +271,28 @@ function editRecord() {
271271}
272272
273273function saveRecord ( ) {
274+ // Find the row index
275+ const index = $ ( this ) . attr ( "data-index" ) ;
276+
277+ // Get the edited values from each field
278+ const values = [ ] ;
279+ values [ 0 ] = $ ( "#enabled_" + index ) . prop ( "checked" ) ? "true" : "false" ;
280+ values [ 1 ] = $ ( "#network_" + index ) . val ( ) ;
281+ values [ 2 ] = $ ( "#ip_" + index ) . val ( ) ;
282+ values [ 3 ] = $ ( "#domain_" + index ) . val ( ) ;
283+
284+ // Save the new values
285+ // --- insert $.ajax() call to actually save the data
286+ console . log ( values . join ( "," ) ) ;
287+
288+ // Finish the edition disabling the fields
289+ $ ( this ) . closest ( "tr" ) . find ( "td input" ) . prop ( "disabled" , true ) ;
290+
291+ // Show EDIT and DELETE buttons. Hide SAVE and UNDO buttons
292+ $ ( this ) . siblings ( '[id^="edit"]' ) . show ( ) ;
293+ $ ( this ) . siblings ( '[id^="delete"]' ) . show ( ) ;
294+ $ ( this ) . hide ( ) ;
295+ $ ( this ) . siblings ( '[id^="cancel"]' ) . hide ( ) ;
274296}
275297
276298function restoreRecord ( ) {
You can’t perform that action at this time.
0 commit comments