How to add standard textbox command to jqgrid context menu?

It's not easy to implement in context menu commands like "Copy", "Paste", ... so I decide to modify my demo from the answer on your previous question. In the new demo the context menu appears only if the page contains no selected text.

It's not easy to implement in context menu commands like "Copy", "Paste", ... so I decide to modify my demo from the answer on your previous question. In the new demo the context menu appears only if the page contains no selected text. The first problem is that the original code of the jquery.contextmenu.

Js contains the following code fragment: $(this). Bind('contextmenu', function(e) { // Check if onContextMenu() defined var bShowContext = (!hashindex. OnContextMenu)?Hashindex.

OnContextMenu(e) : true; if (bShowContext) display(index, this, e, options); return false; }); So the contextmenu handler return always false and prevent creating of the standard context menu. I fix the code to the following (you can download full modified code here): $(this). Bind('contextmenu', function(e) { // Check if onContextMenu() defined var bShowContext = (!hashindex.

OnContextMenu)? Hashindex. OnContextMenu(e) : true; currentTarget = e.

Target; if (bShowContext) { display(index, this, e, options); return false; } }); The code of createContexMenuFromNavigatorButtons functions described here I modified onContextMenu: function (e) { var rowId = $(e. Target). Closest("tr.

Jqgrow"). Attr("id"), p = grid0. P, i, lastSelId; if (rowId && getSelectedText() === '') { ... return true; } else { return false; // no contex menu } } to use getSelectedText() and to create the context menu only if no text is selected.As the result you will be see your custom context menu only if no text is selected and see the standard context menu (which depend on web browser) if the text selection exist: UPDATED: I modified my bug report about jquery.contextmenu.

Js with additional information based on the answer. I hope that the changes will be soon in the main code of jquery.contextmenu. Js included in the plugins subdirectory.

UPDATED 2: How you can see here all the fixes are already in the main code of jqGrid on the github and in included in the jqGrid 4.3. UPDATED 3: If you want to have the standard context menu for all enabled , and elements you should just modify a little the code inside of onContextMenu callback. For example onContextMenu: function (e) { var p = grid0. P, i, lastSelId, $target = $(e.

Target), rowId = $target. Closest("tr. Jqgrow").

Attr("id"), isInput = $target.Is(':text:enabled') || $target. Is('inputtype=textarea:enabled') || $target. Is('textarea:enabled'); if (rowId &&!

IsInput && getSelectedText() === '') { ... see one more demo where inline editing will be activate by double-click.

Thank you very much. If text is not selected, paste and select all commands should be still available. How to add standard textbox context menu to the custom menu you created?

In this case both commands are available. – Andrus Dec 11 at 22:18 @Andrus: I think it's not possible. – Oleg Dec 11 at 22:23 Maybe it is possible to use solutions from stackoverflow.Com/questions/400212/… or others?

– Andrus Dec 11 at 22:54 @Andrus: I seen the answer before, but the usage of Flash is not an option for me in the pure JavaScript solution. Moreover the standard context menu is absolutely different in different browsers. – Oleg Dec 11 at 22:58 Thank you.

Copy command can implemented using javascript prompt as described. How about implementing select all, paste, delete commands? It looks like everything can implemented in javascript.

– Andrus 23 May8 at 7:53.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions