Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Topic author was deleted

    Apr 10, 2013 @ 21:57

    How do you get the BaseDataType inside the IDataEditor?

    Ok,

    This may be hard to explain or maybe I'm just missing something easy.

    I'm working on a custom data type.  From inside the IDataEditor, I need to know what BaseDataType is for the current instance.

     

    So if I have a DataType called X.   I then create two separate instances of X called A and B.

    At runtime, I would like to know that I'm inside A or B or whatever the current instance is while inside of the DataEditor.

    Ideally I need to know the unique instance ID of A or B.

    Please note I'm not asking for the data editor GUID which is the same for A and B.

    I'm after the instance GUID of A\B.

    Hope that made sense.

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Apr 10, 2013 @ 22:02
    Tom Fulton
    100

    Hi Kevin,

    Have a look at the source for XPathDropDownList (first line in Save method).  It has some code to grab the Property instance that the datatype is being used on, from there I think you could probably get what you want.

    -Tom

  • Comment author was deleted

    Apr 10, 2013 @ 22:10

    Thanks for the quick reply.  I'm pouring over it now.  You just might be 2/2 for me this week ;)

  • Comment author was deleted

    Apr 10, 2013 @ 22:21

    Boom like dynamite, that worked great Tom thx.

    I'll have to do some further seraching to get the GUID (or I may switch to this value), but that is a huge help.  The below code returns the int for the data type (seen when hovering over the item in the datatype tree)

    int umbracoNodeID = ((Widget_Builder_Default_Data)savedData).DataTypeDefinitionId;
  • Comment author was deleted

    Apr 11, 2013 @ 14:09

    Just for completeness for any following readers.  This will yield the individual instanceID and GUID if needed for a data type while within a data editor.

    There may be a cleaner way, but this certainly gets you there.

    int instanceNodeID=((YouDEFAULTdataTYPEclassHERE)savedData).DataTypeDefinitionId;//the int
    DataTypeDefinition dataTypeDefinition = DataTypeDefinition.GetAll().Where(d => d.DataType.DataTypeDefinitionId == instanceNodeID).First();
    Log.Add(LogTypes.Debug, 0, "wbDtD=>" + dataTypeDefinition.UniqueId);//the GUID
  • Comment author was deleted

    Apr 11, 2013 @ 14:11

    Oh and the 'savedData' above is your IData interface var.

Please Sign in or register to post replies

Write your reply to:

Draft