Nested editors

Nested editors

lrabbitlrabbit Posts: 12Questions: 1Answers: 0
edited March 2013 in Editor
Hello,

Probably a strange question, but is it possible to nest editors.

For example, if I create an editor type extension that shows a datatable in the edit form,
can I then use an editor on that table?

Hope that makes sense :-)

Cheers,

Paul.

Replies

  • aveakaveak Posts: 15Questions: 0Answers: 0
    I swear I was just coming in here to ask this question.

    Tried to implement an editor with a resulting form that contains a table with a related list, where the values use an editor. Everything seems to work, except when I attempt to open an editor window on that small, nested table, nothing happens.
  • allanallan Posts: 61,438Questions: 1Answers: 10,052 Site admin
    Excellent question - fundamentally, yes this absolutely is possible. The one thing that holds back the default Editor is the lightbox display controller method expects just a single instance of Editor to be used at a time. With a display controller which can handle the display of multiple Editor instances at the same time (perhaps in a stacked view), then there is absolutely no reason why you could create a table field type plug-in which itself has Editor controls on it.

    I'm not saying its going to be trivial (nor at the same time should it be too complex!) but it absolutely is possible to work with multiple Editor instances.

    Regards,
    Allan
  • lrabbitlrabbit Posts: 12Questions: 1Answers: 0
    Ahhhh! I hadn't thought of trying the envelope display. Creating the fieldtype with a datatable was good (with a bit of css to get it to play nice within the editor form) Thanks! In fact the envelope display probably works better on the datatables within an existing editor. (Rather than windows popping on windows).

    Fantastic.

    Thank you Allan.
  • allanallan Posts: 61,438Questions: 1Answers: 10,052 Site admin
    Superb - glad to hear that worked well for you.

    Regards,
    Allan
  • aveakaveak Posts: 15Questions: 0Answers: 0
    Ok, this functions, at least, but the display is a bit wonky.

    Is there a way to control or position the envelope top edge? At the very least, I'd like to position it at the top of the editor window. Right now, it seems to position itself someplace in the middle of the page behind the lightbox, scroll it down a little bit, and then open itself up.

    Like I say, it actually functions -- it just looks messy.
  • aveakaveak Posts: 15Questions: 0Answers: 0
    Here's what I tried, but it didn't seem to work. I feel fine doing this, as the only time I'm using Envelope for this application is when I'm nesting inside an editor window.

    var envelopeConf = $.fn.dataTable.Editor.display.envelope;
    envelopeConf._findAttachRow = function() { return $('div.DTE_Body'); }
    envelopeConf.conf.windowScroll = false;

    I'm trying to get it to scroll down "out" of the top edge of the editor's body area. I imagine that there's a CSS element that's unique to the THEAD of a table that the DTE_Body DIV for the Editor window doesn't carry. Still poking at it.
  • aveakaveak Posts: 15Questions: 0Answers: 0
    Ah, figured it out:

    envelopeConf._findAttachRow = function() { return $('div.DTE_Header')[0]; }

    ...this actually looks sort of slick, now.
  • allanallan Posts: 61,438Questions: 1Answers: 10,052 Site admin
    Very nice. Sorry I didn't get a chance to answer back in time before, but great to hear you got it working.

    Allan
This discussion has been closed.