[wp-trac] [WordPress Trac] #12769: Disappearing posts/pages (in quickedit mode)
WordPress Trac
noreply at wordpress.org
Wed Dec 31 14:37:50 UTC 2014
#12769: Disappearing posts/pages (in quickedit mode)
-----------------------------+-----------------------------
Reporter: catahac | Owner:
Type: defect (bug) | Status: new
Priority: low | Milestone: Future Release
Component: Quick/Bulk Edit | Version: 2.9.2
Severity: minor | Resolution:
Keywords: needs-patch | Focuses:
-----------------------------+-----------------------------
Comment (by kevdotbadger):
I think the problem is caused the removal and appending of the new row
returned by the AJAX request, although I'm not 100% sure (it might have
something to do with either the ID getting messed up, or which rows are
being removed, or the revert() happening at the beginning of the edit, or
something else!?)
Anyway, the old code was
{{{
$(inlineEditPost.what+id).remove(); // Remove the original (now hidden)
post row
$('#edit-'+id).before(r).remove(); // before the editor row, add the new
HTML returned by the save AJAX request, then remove the edit row
$(inlineEditPost.what+id).hide().fadeIn(); // with the new returned and
added to the DOM, hide it then fade in.
}}}
My solution was to use the original row, and not remove it at all. Simply
inject the needed HTML back into it. This solves bug.
{{{
$('#edit-'+id).remove(); // Remove the edit row
$(inlineEditPost.what+id).empty().append($(r).html()).fadeIn(); // Inject
the needed HTML the original post row and fade in
}}}
The `r` returned by the AJAX call contains the whole row as HTML, I'm not
sure if this returned HTML is used elsewhere, so i left that alone. The
`$(r).html()` simply gets the child elements which we need to inject back
into the original row.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/12769#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list