Different editors depending on type?

Different editors depending on type?

panzrampanzram Posts: 21Questions: 8Answers: 0

I know how to create different editors and how to have one button for creating type A with editor A and another for type B, but how can I edit a table entry and get the correct editor?

Simple example:

Name, Type, Amount
Name 1, Type A, 100
Name 2, Type B, 200
Name 3, Type A, 150

That is, if I edit "Name 1" or "Name 3" I get the editor A and if I edit "Name 2" I get editor B.Is there an event for pre-open the editor that I can catch?

Also, the ideal idea would be to be able to switch editor by catching a type combobox change event, like a tabbed editor. If I could do that, I would only need one button and let the combobox be the event driver.

Answers

  • allanallan Posts: 48,657Questions: 1Answers: 7,068 Site admin

    By combo box, do you mean using Select2 or Selectize or something like that? You can certainly do that and the plug-ins for Editor to allow that are available here. If that covers your needs, that would be better than trying to use two different editors or switching input types. Does it?

    Allan

  • panzrampanzram Posts: 21Questions: 8Answers: 0

    Hi Allan,

    Sorry, old habits die hard. Yes, I meant select2 or selectize by combobox. However, I also meant that if there are tabs (like a tabbed panel), one could use the select2 to switch between tabs. That is, the tabs function like an editor, and select2 switches between them.

    As far as I know, there is no tabbed panel. I found this discussion on the subject:

    https://datatables.net/forums/discussion/36270/solved-how-to-do-tabs-with-editor

    ...but I haven't seen it implemented. Hence, I think I need two editors and some way of catching an pre-editor show event to switch between the two on type.

  • panzrampanzram Posts: 21Questions: 8Answers: 0
    edited January 3

    I just realized I might have been a bit vague. The table might look like above, but the objects are very different. Type A might have 10 parameters, and type B might have 50 completely different parameters. Hence, the editors are completely different.

  • allanallan Posts: 48,657Questions: 1Answers: 7,068 Site admin

    To implement tabs, I would use a custom template and that template would contain the tabs. You could also have a select / select2 in your template that is not under control of Editor that will switch the tabs as needed.

    Allan

Sign In or Register to comment.