jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Confirming for changes before switching to the next grid row
Tagged: editing, jqxgrid, rowediting
This topic contains 1 reply, has 2 voices, and was last updated by Stanislav 7 years, 9 months ago.
-
Author
-
Hello,
I need your help.
In a typical scenario, the user makes changes to fields in a user form. Using jQuery’s “on input”, this triggers the save button to become from disabled to not disabled.
Now, what i’d like to do is upon the user selecting another grid row to confirm their changes – if any (ie. checking in the button “save” is disabled or not before switching to the next row.
What I have been working with is this, however, it switches to the next grid row while the save function continues to write data back into my DB:
$("#jqxgrid").bind('rowselect', function (event) { if (document.getElementById('save').disabled == false) { if (confirm("Do you want to save the changes you made to "+document.getElementById('fileno').value +"?")) { imts_save_changes() } } var i = event.args.rowindex document.getElementById('fileno').value = $('#jqxgrid').jqxGrid('getcellvalue', i, "c0") check_recurrence($('#jqxgrid').jqxGrid('getcellvalue', i, "c0")) $('#date1').val($('#jqxgrid').jqxGrid('getcellvalue', i, "c1")) document.getElementById('reqtype').value = $('#jqxgrid').jqxGrid('getcellvalue', i, "c2"); document.getElementById('doctype').value = $('#jqxgrid').jqxGrid('getcellvalue', i, "c3"); document.getElementById('client').value = $('#jqxgrid').jqxGrid('getcellvalue', i, "c4"); document.getElementById('status').value = $('#jqxgrid').jqxGrid('getcellvalue', i, "c5"); CheckOption('action',$('#jqxgrid').jqxGrid('getcellvalue', i, "c6")) document.getElementById('action').value = $('#jqxgrid').jqxGrid('getcellvalue', i, "c6"); document.getElementById('refdocs').value = $('#jqxgrid').jqxGrid('getcellvalue', i, "c7"); document.getElementById('assignee').value = $('#jqxgrid').jqxGrid('getcellvalue', i, "c8"); $('#date8').val($('#jqxgrid').jqxGrid('getcellvalue', i, "c9")) document.getElementById('branch').value = $('#jqxgrid').jqxGrid('getcellvalue', i, "c10"); fetch_branch_routings(document.getElementById('branch').value) document.getElementById('division').value = $('#jqxgrid').jqxGrid('getcellvalue', i, "c11"); document.getElementById('opi').value = $('#jqxgrid').jqxGrid('getcellvalue', i, "c12"); $('#date2').val($('#jqxgrid').jqxGrid('getcellvalue', i, "c13")) $('#date3').val($('#jqxgrid').jqxGrid('getcellvalue', i, "c14")) $('#date4').val($('#jqxgrid').jqxGrid('getcellvalue', i, "c15")) $('#date5').val($('#jqxgrid').jqxGrid('getcellvalue', i, "c16")) $('#date6').val($('#jqxgrid').jqxGrid('getcellvalue', i, "c17")) $('#date7').val($('#jqxgrid').jqxGrid('getcellvalue', i, "c18")) document.getElementById('summary').value = br2nl($('#jqxgrid').jqxGrid('getcellvalue', i, "c19")) document.getElementById('keytopic').value = $('#jqxgrid').jqxGrid('getcellvalue', i, "c20") document.getElementById('comments').value = br2nl($('#jqxgrid').jqxGrid('getcellvalue', i, "c21")) CheckOption('email',$('#jqxgrid').jqxGrid('getcellvalue', i, "c22")) document.getElementById('email').value = $('#jqxgrid').jqxGrid('getcellvalue', i, "c22"); document.getElementById('modby').value = $('#jqxgrid').jqxGrid('getcellvalue', i, "c23"); document.getElementById('datemodified').value = ($('#jqxgrid').jqxGrid('getcellvalue', i, "c24"))?dateFormat($('#jqxgrid').jqxGrid('getcellvalue', i, "c24"), 'default'):"" document.getElementById('dateclosed').value = ($('#jqxgrid').jqxGrid('getcellvalue', i, "c25"))?dateFormat($('#jqxgrid').jqxGrid('getcellvalue', i, "c25"), 'default'):"" check_duedates() if ($('#date2').val()) { document.getElementById('box_date2').disabled = false } if ($('#date3').val()) { document.getElementById('box_date3').disabled = false } if ($('#date4').val()) { document.getElementById('box_date4').disabled = false } $('#save').prop('disabled', true) });
Hello Buggs,
When you edit the row, how do you do it? Do you use an Ever Present Row or just a normal Row Edit. Also, it would be greatly appreciated if you could send us an Example.
I would also suggest you have a look at Popup Editing.Best Regards,
StanislavjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.