I am attempting to populate a checkbox in a dialog based upon the checkbox in a selected table row. The page has multiple tables. The tables have the same columns and a variable number of rows. Each row has one checkbox. When clicking on the row's edit icon, I open a dialog window. I am attempting to set the property of the dialog property checkbox to the property of the row property and am not having success: I have read every jquery checkbox posting and tried the solutions. These are my last 2 tries:
$('.ui-icon-pencil').click(function(e) {
var initialRow = $(this).parent().parent();
var $thisFieldset = $("#bookmark-data-fieldset");
var urlid = $("td:first", initialRow).text();
/*default dialog checkbox to not checked*/
$('#dialoggoalstatus').removeAttr('checked');
var urlname = $("td:nth-child(2)", initialRow).text();
var newurlname = urlname.trim();
var goal_date = $("td:nth-child(3)", initialRow).text();
$('#bookmark-goaldate').val(goal_date);
/* populate the dialog checkbox with the property of the
row checkbox*/
$("#dialoggoalstatus").prop($("td:nth-child(4)",
initialRow).find(':checkbox').prop('checked'));
/* I also tried this*/
$("#dialoggoalstatus").prop($(initialRow).
find('td input:eq(4)').is(':checked'));
This did not work. Can you help me identify what I am missing?
In addition, I attempting to then populate the table with the selection of made in the dialog form.
I am using this:
var goalid = $("td:first", initialRow).text();
$("td:nth-child(2)",initialRow).text($("#namefield").val());
$("td:nth-child(3)", initialRow).text($("#datefield").val());
$("td:nth-child(4)", initialRow).
prop($( "#dialoggoalstatus").prop('checked'));
This also is not working.
Any help would be greatly appreciated.
Aucun commentaire:
Enregistrer un commentaire