Login Register

How do you reference the source/target in a custom creator function?

Is there a way that I can reference the source or target for my custom creator, without using the jsId name directly in the code? See my code sample below:

<table width="100%" id="myTable" class="borderTable">
        <tbody dojoType="dojo.dnd.Source" jsId="myTbl_id" accept="searchResult" copyOnly="true">
                <tr>
                        <th>Title</th>
                        <th>Name</th>
                        <th>Info</th>
                        <th>Creator</th>
                </tr>
                <script type="dojo/method" event="creator" args="item, hint">return myCreator(item, hint);</script>
        </tbody>
</table>

function myCreator(workspaceData, hint) {
        var oldCheckAcceptance = myTbl_id.checkAcceptance;
        // override default checkAcceptance() method with our own to do check
        myTbl_id.checkAcceptance = function(source, nodes) {
                // my custom code
        }
       
        // my creator code
};

Instead of referencing myTbl_id directly using the name assigned to the jsId attribute, is there a way I can reference it some other way? For example, in the DOM, I can reference a node's parent node by using node.parentNode. Is there some way similar that I can do that in my case? Any other suggestions for accomplishing what I am trying to do?

Unfortunately there is no

Unfortunately there is no provision for that at the moment. The creator function was envisioned as being a source-independent. But your case has its merits — please file an enhancement ticket against DnD.