i using jquery editinplace plugin, default way of doing edit in place using click event on selector, way trying through context menu calls function "rename();". how block inline edit on click event. please share idea on how this...
$('.context').editinplace({ callback: function(idofeditor) { var renameurl = "http://www.google.com/"+tablerowid+"/"+enteredtext+""; return enteredtext; } });
open /jquery.editinplace.js source file. (online version > http://code.google.com/p/jquery-in-place-editor/source/browse/trunk/lib/jquery.editinplace.js)
in first function declaration $.fn.editinplace
line#26, change following line :
new inlineeditor(settings, dom).init();
into >
dom.theeditor = new inlineeditor(settings, dom); dom.theeditor.init(); dom.data("theeditor", dom.theeditor);
now inside click event of context menu function, call >
$("#mycontextmenuelement").live("click", function (e) { //your other code rename(e); //you need pass event argument });
make sure pass 'e' it.
and in rename function >
function rename(e) { $("#myelementtoeditinplace").data("theeditor").openeditor(e); }
works charm !
edit:
to ensure don't allow user active editor clicking on para > use code :
var mydelegate = { shouldopeneditinplace: function (a, b, c) { if (c.target.id != "idofyourcontextelement") { //if edit not invoked through context menu option return false; //cancel editor open event } return true; } };
and add delegates in initialization>
$('.context').editinplace({ callback: function(idofeditor) { var renameurl = "http://www.google.com/"+tablerowid+"/"+enteredtext+""; return enteredtext; }, delegate: del });
Comments
Post a Comment