Reputation: 26006
In this JSfiddle
http://jsfiddle.net/littlesandra88/jy93J/1/
have I the problem that when Save is clicked, it replaces "Details" with "0".
If I comment this line
$(this).prev().html(order);
it doesn't do it any longer, but then sorting doesn't work. Try clicking on "Signed" to sort.
When Save is clicked this is executed
$('form').live('submit', function() {
return false;
});
What causes "Details" to "0"?
And how can that be fixed, so sorting still works?
Upvotes: 1
Views: 104
Reputation: 7521
You are pointing to all HTML input elements, here: save button and checkbox.
Change
$('#accTable input').click(function() {
to
$('#accTable input[type=checkbox]').click(function() {
and it will work just fine.
Upvotes: 1
Reputation: 1059
I updated your fiddle to fix the problem.
In the click function, you were including both buttons and check boxes since you had just input. Once you append :checkbox it stops this from executing the event on the save button, which is what was putting 0 in the element before it (details link).
$('#accTable input:checkbox').click(function() {
var order = this.checked ? '1' : '0';
$(this).prev().html(order);
$(this).parents("table").trigger("update");
});
Upvotes: 1
Reputation: 887777
The selector '#accTable input
includes <input value="Save" type="submit">
.
Add :checkbox
to the selector to only select input
elements that are checkboxes.
Upvotes: 2