I have added to what in the Basic Crud Application example is the editUser() function in order to translate my database value of 1 or 0 to checked or unchecked. But it only works the first time...
function editRecord(){
var row = $('#dg').datagrid('getSelected');
if (row){
$('#dlg').dialog('open').dialog('setTitle','Edit Class');
$('#fm').form('load',row);
if(row.IsActive=='1'){
$.messager.show({ // always triggers correctly
title: 'Watch',
msg: 'IsActive is 1'
});
$('#idformIsActive').attr('checked',true); // only works the first time
}
url = 'data_update.php?estimatelinedetail_id='+row.id;
}
}
The messager pop up triggers correctly when editing rows where isActive == 1. Happy days
BUT the checkbox input (#idformIsActive) is correctly checked only the first time you invoke the edit form.
Subsequent invocations of the form show it unchecked even when the value = 1..
Any ideas? Thanks in advance.
The next question is going to be:
How do I translate the checked or unchecked checkbox field states into a 1 or 0 to save in the database?