Hybrid link and edit exCell cell type

I saw several references on this forum to a hybrid custom grid exCell column type combining the “ed” editable cell and the “link” cell into an editable link exCell. But, to my dismay, no-one provided sample code. So, after working out how to do it myself, I’m uploading my code.

Attached is a javascript file, dhtmlx_excell_edlink.js (wrapped into a zip file). Put this into your codebase subfolder (instead of dhtmlx_excell_link.js) and add the filename to your includes like so:

<script src="../codebase/dhtmlx.js" type="text/javascript"></script> <script src="../codebase/connector.js" type="text/javascript"></script> <?--include this separately--?> <script src="../codebase/dhtmlxgrid_excell_edlink.js" type="text/javascript"></script> <?--include this separately--?>

Define your column types using “edlink” instead of “link”, like so:

gridEvents.setHeader(["Name","","Date","Location","Note","Organizer","Poly","Coord"]); gridEvents.setColTypes("edlink,rotxt,dhxCalendar,coro,txt,edtxt,ch,rotxt");

…and you’re done.

The code is just a slightly adapted version of dhtmlxgrid_excell_link.js, so it behaves identically, except that you can double-click the cell and edit it like any editable cell. Type in the desired link text, then a “^”, then the URL (and, optionally, another “^” and a target type–_self, _top, _parent or _blank). Once you leave the cell, it will instantly become a clickable link. If there’s no “^” anywhere within the cell, you’ll get text only–no link.

One quirk: Because the cell content is a link (or an invisible “null” link), you have to double-click in a BLANK, empty area of the cell to trigger the edit behavior. Clicking directly on the text will either jump to the link, if there is one, or do nothing at all, if there isn’t.
dhtmlxgrid_excell_edlink.zip (1.12 KB)

P.S. This was written and tested with DHTMLX 3.6. It may work with 4.0, but has not been tested on the new version of the suite.