1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Custom Module (with custom child modules)

Custom Module (with custom child modules)

6 posts, 0 answered
  1. Miles
    Miles avatar
    32 posts
    Registered:
    23 Nov 2011
    31 Jan 2012
    Link to this post
    I'm creating a custom module (Class) and each entity could have multiple custom children modules (Sessions). I've used the Module Builder to create the Class module and I'm thinking of creating the Session object through the Module Builder. Here are some of the questions I'm thinking I'm going to run into:

    1. To create the relationship between the two modules, do I just need to do it in the database? Or is there an easy way through the UI? (I have a short text field in the Session module to place the class's baseID in).

    2. When a property of the Class item is modified, I'm going to need to create some Sessions. I've created a custom Field and Dialog for this, but how do I get the currently modified Class baseID while I'm editing it? (I'm currently doing all of this in the dialog's JS file)

    3. When editing a Session object through the backend UI, is there a simple way to pull a property from the parent object? (just to display)

    Let me know if I need to clarify anything that might have gotten a little too wordy :P
  2. Svetoslav Petsov
    Svetoslav Petsov avatar
    456 posts
    Registered:
    24 Sep 2012
    03 Feb 2012
    Link to this post
    Hello,

     Our module builder doesn't support hierarchical modules yet, so you cannot "relate" to modules, created by it in any way for the moment. What I can suggest as a workaround is use taxonomies for your case.
    On the second question - I don't really get what you need. From what I understand you want to take the current item's ID in Edit mode, but why do you need that?
    The last question is related to the first one I suppose - there is no way to create hierarchical structure of items, created by Module builder.

    Kind regards,
    Svetoslav Petsov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Miles
    Miles avatar
    32 posts
    Registered:
    23 Nov 2011
    03 Feb 2012
    Link to this post
    On the second question, here's my logic.

    I'm going to be editing a class and I'll need to create some child items when the class is saved. So, I've found a way to call a server side C# method from jQuery and I was going to call it when a user is editing a property I've created. When they are editing this property, I have a custom dialog to get some information from them and from a button click inside of it, I'll call my function. So everything works great except I don't know what the ID of the class that's currently being edited inside the dialog. I didn't know if there was something I could pull from my custom field class that I could push to my dialog.

    I'm needing this so I can create the child items and have them associated with the parent. I'm able to create the children but I have no reference to which parent item is currently being modified.
  4. Svetoslav Petsov
    Svetoslav Petsov avatar
    456 posts
    Registered:
    24 Sep 2012
    08 Feb 2012
    Link to this post
    Hi Miles,

     I still cannot get the whole picture. So, you currently have a field control in your module and this field control opens a dialogue to create child items of the current Content item. What you want to do is from the field control, get the ID of the current Content item that you are editing (while in edit mode) and pass it to the dialogue, so that you can use it inside this dialogue to create child content items. Is that correct?
    Also, is there a chance that you could post a screenshot of the module in the backend (how the create/edit page and the field in question look like), so that I can get a better picture of it? Thanks in advance.

    All the best,
    Svetoslav Petsov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Miles
    Miles avatar
    32 posts
    Registered:
    23 Nov 2011
    08 Feb 2012
    Link to this post
    Right, that is exactly what I'm trying to do (unless you can think of a better way to do it with what Sitefinity is already set up for).

    Attached are some screen shots. I'm calling my server side function to create the child sessions when the user clicks the "Done" button.
  6. Svetoslav Petsov
    Svetoslav Petsov avatar
    456 posts
    Registered:
    24 Sep 2012
    10 Feb 2012
    Link to this post
    Hello Miles,

     I'm afraid that there is no way to get the current DataItem in a field control. The field control simply has no access to the data item, it just sets a value to one of its Data Columns on SetValue and has no further references to the current data item. The way our UI is built right now, I don't think you will be able to create child items of an item through Field Controls like that.

    Kind regards,
    Svetoslav Petsov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
6 posts, 0 answered