Custom/Reactive Column Editor

Custom/Reactive Column Editor

terinfireterinfire Posts: 11Questions: 4Answers: 0
edited December 2019 in Free community support

In regards to the Editor, is there a way to make something reactive to what was selected in another column?

For example, I have two columns -- the first is a selector of "type" and the second column is the "value."

I want to make it so that a few of the type's (First column) have masked text editors on the value (Second column) field. I'd like for a few of the type's to also have a "dropdown" selector for the value field as well.

i.e.

if User selects Type A, B, or C on Column 1
Column 2 displays a TextBox with masked input.

if User selects Type D or E on Column 1
Column 2 displays a selector (with constant values)

Is that possible?

I should add that this is an "inline" editor -- it looks like there is something of this in Dependent fields example. The data specified, though, in column 2 would be relevant on the server-side for either masked input or a constant.

https://editor.datatables.net/examples/api/dependentFields.html

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Yep, that link you posted is how to go on the form. The problem with inline editing is that each edit is sent to the server immediately, so you can't use dependent(). There, you would use preSubmit,

    Colin

  • terinfireterinfire Posts: 11Questions: 4Answers: 0

    Are there any examples that have custom (or multiple) columns in Inline Edit?

    I'm curious if there's a "better" way to handle this?

    Or if there's a way to make "two" inputs show up in one column?

    Right now I have a "Type" and a "Value" field. The Type field has a dropdown of different data items. Value has a masked input (text) that updates based on the type selected (provided back as an Editor field -- not displayed in the Table, but shown as a Tooltip/Message).

    If a user selects a certain "Type," the "Value" field shouldn't show a masked input/text. It should show a Dropdown AND a Textbox.

    For the life of me, I cannot figure out how to do this.

  • allanallan Posts: 63,160Questions: 1Answers: 10,405 Site admin
    Answer ✓

    This sort of cascade doesn't play nicely with inline editing I'm afraid. A bubble edit would be the option to use instead if you have two fields dependent on each other.

    The main limitation is that Editor's inline editing just doesn't support multiple cells being in edit mode at a time. That is something that will be added in future, but at the moment the upshot is that if you edit a cell you can't edit another cell until you've submitted (and validated) that first one.

    Allan

  • terinfireterinfire Posts: 11Questions: 4Answers: 0

    That's what I figured. I managed to KIND OF get the design I was working with, changed to use custom editor fields. The solution became too cumbersome (but was doable). I ended up scrapping the design and reworking it to better fit DataTables.

    In a future release, it'd be really useful if Inline could configure "visibility" of a column and allowing for both to become "active" and send them both off for validation on submit, rather than one field (if that makes sense).

    My DataTable (non-editor) can handle this via render on a field (it does this right now).

This discussion has been closed.