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